++i v.s i++
When the ++ operator precedes the variable, it is called the pre-increment operator. It increases the value of the variable by 1 and then uses the updated value in the expression.
Example:
int i = 5;
int j = ++i; // i is incremented by 1, then j takes the value of i (6)
When the ++ operator follows the variable, it is called the post-increment operator. It uses the current value of the variable in the expression and then increases the value by 1.
Example:
int i = 5;
int j = i++; // j takes the value of i (5), then i is incremented by 1