In C, what is the difference between using ++i and i++, and which should be used in the incrementation block of a for loop?
++i
i++
for
The following C code fragment illustrates the difference between the pre and post increment and decrement operators:
int i; int j;
Increment operators:
i = 1; j = ++i; // i is now 2, j is also 2 j = i++; // i is now 3, j is 2