++i and i++ do not really give you the same result everytime.
++i in this case is called the pre-increment operator. This will first add 1 to i and give you the new value of i.
i++ in this case is called the post -decrement operator, because im lacking words to express this i will do it by example. here x is assigned the original value of i first and then i is increased by 1.
Example from the book that im reading.
Code:
#include <stdio.h>
main()
{
int w,x,y,z, result;
w = x = y = z = 1; /*initialize x and y*/
printf("Given w =%d, x =%d, y=%d, and z =%d,\n", w, x,y,z);
result = ++w;
printf("++w evaluates to %d and w is now %d\n", result, w);
result = x++;
printf("x++ evaluates to %d and x is now %d\n", result, x);
result = --y;
printf("--y evaluates to %d and y is now %d\n", result, y);
result = z--;
printf("z-- evaluates to %d and z is now %d\n", result, z);
return 0;
}