+ 3
Difference between these
what is the difference between for (a=0;a<5;a++) and for (a=0;a<5;++a)
3 Answers
+ 13
@Ponraj
The version that has ++a can be ever so slighty faster as no temporary copy of the a variable needs to be created.
in most instances the time difference is negligible.
http://www.cplusplus.com/forum/beginner/22073/
+ 12
@Shawn. Indeed! Still good knowledge to keep in the back of ones mind though. not all compilers are created equal. but in this respect you are correct. most if not all will change it (a++) to the most efficient version
+ 10
The compiler would be able to do a great job at optimising your code so both won't make much difference (if any difference exist in the end, that is).