Can i do this in C? (i < 0) ? i = 1 : NULL;
Of course.
And it's called a ternary operator
Originally Posted by Milhas Can i do this in C? Yes, but I'd do it this way: Code: i = (i < 0) ? 1 : i; But why bother when you can: Code: if(i < 0) i = 1;
i = (i < 0) ? 1 : i;
if(i < 0) i = 1;
Nice! Thanks!!