+ 14
Which is the correct statement?
preincrement is faster than postincrement postincrement is faster than preincrement none
2 odpowiedzi
+ 12
pre-increment generally is faster and requires less memory than post-increment.
0
Post-increment usually involves keeping a copy of the previous value around and adds a little extra code. Pre-increment simply does it's job and gets out of the way. I typically pre-increment unless the semantics would change and post-increment is actually necessary. thus preincrement requires less memory and so faster.