Macro Arguments

I would like to know what does the code below do?
 
x = (x++ > y) ? (x+y) : (x-y);
If x > y then x = x + 1 + y
Otherwise x = x + 1 - y

For example let assume that x == 2 and y == 2 in this case x is not greater than y so x will be set to x + 1 - y that is x will be equal to 1.

It is the so-called conditional operator.
Last edited on
Thank you :) I've got it.
Topic archived. No new replies allowed.