DiAvOl wrote:
yes, it's correct but note that you should avoid to:
1) use the increment or decrement operators on a variable that appears
more than once in an expression
For example avoid using constructs like the following
n = 1;
y = n++ + n++;
2) use the increment or decrement operators on a variable that is part
of more than one argument of a function
Example to avoid
printf("%d %d\n", number, number*number++);
The reason is because the second argument might be evaluated before
the first one
You forgot the one thing to avoid:
3) Never use pre or post increment as parameters to macros, as a macro
might use the parameter more than once. As a consequence, item 2
should be "never use increment or decrement on parameters to a
function", as you might not know if this is a real function, or that
this was implemented as a macro.
Kind regards,
Johan Borkhuis