if ( <condition> ) <statement 1> [else <statement 2>]but this "statement" has no value. C provides a conditional expression which can conditionally evaluate to a value:
<condition> ? <expression 1> : <expression 2>which evaluates to <expression 1> if <condition> is true, otherwise to <expression 2>.
We might use this epression in place of a function call for absolute:
x = (x < 0) ? -x : x;or better, define a macro:
#define ABSOLUTE(x) (((x) < 0) ? -(x) : (x))and write
diff = ABSOLUTE(diff);