What is the name of this operator: “--”?
stackoverflow.com
stackoverflow.com
[1]: http://stackoverflow.com/questions/1642028/what-is-the-name-...
The answer that shows it with the brackets is probably the clearest:
while ((x--) > 0)
{ ... }
The compiler sees that as the same as (x--> 0)So it checks if x is more than zero and then decrements it each loop iteration.
#define as ;while
...
do printf("n is %d\n", n) as ( n --> 0);
Parses to (white space adjusted for clarity): do printf("n is %d\n", n);
while ( n-- > 0); do {
printf("%d",x);
} while (x-- > 0); while (x --\
\
\
\
> 0)
printf("%d ", x);
That's fantastic!