The difference is that the post-increment operator i++
returns i
as it was before incrementing, and the pre-increment operator ++i
returns i
as it is after incrementing. If you're asking about a typical for
loop:
for (i = 0; i < 10; i++)
or
for (i = 0; i < 10; ++i)
They're exactly the same, since you're not using i++
or ++i
as a part of a larger expression.