Writing loops with i++ or ++i [duplicate]
- by Nonesuch
This question already has an answer here:
Why use ++i instead of i++ in cases where the value is not used anywhere else in the statement?
6 answers
format of for loops
31 answers
I have a question about writing loops. I always begin with
(int i=0; i<10; i++)
But I see many experts begin with
(int i=0; i<10; ++i)
Is there there any real difference, or they are same?
Of course, I know the difference between pre-increment and post-increment. I mean which one I should use when writing the loop? or it depends.
Thanks!