++i and i++ both are unary operators used for incrementing value by one. ++i is called a pre-increment operator as it first increments the value and then it assigns to variable whereas i++ is a post-increment operator which first assigns the value to the variable and then it increments the value.
#include<stdio.h>
int main()
{
int i ,j ,x,z;
i=10;
j=10;
x=++i; //pre-increment
z=j++; //post increment
printf("the result = %d ",x);
printf("the result = %d ",z);
return 0;
}
Run this program and you will find that x has been assigned incremented value whereas z has been assigned the original value.
For loop, pre-increment can be preferred as it takes less time for internal computation.
But in case if you are using the previous value then use the post-increment operator.