nickthedude nickthedude - 23 days ago 6
Objective-C Question

isn't there an operator in c to change the sign of a int float etc from negative to positive or vice versa?

trying to find absolute value and i thought there was a simple way to just invert the sign with '~' or something.

Answer
float newValue = oldValue * -1;

or

float newValue = -(oldValue); //() aren't needed, I just use them out of habit