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
++i increments the value, then returns it.
i++ returns the value, and then increments it.
It's a subtle difference.
For a for loop, use ++i, as it's slightly faster. i++ will create an extra copy that just gets thrown away.