modulu

Write your question here.

1
2
  int x;
  x= (x%2)?1:2;


what does this do "?1:2" please help????
It is a ternary operator used for short if/else cases. The above code can be converted to:

if(x % 2)
x = 1;
else
x = 2;
Topic archived. No new replies allowed.