+ 4
Which one is faster i=i+1 or i++
i=i+1 and i++ both will increment i by one but in compiler prospective which one is faster i know answer try to answer it
9 Answers
+ 17
++i can be faster than either of the other 2 đ
Dunno exactly why though, just is
+ 15
i++ is a increment operator it takes less load then i=i+1as it consume less time and space in compilation process
+ 5
i++ is faster because
they return value before. then increment,maybe....
+ 5
Oh yeah.Why I didn't think like that?
@Swamy
+ 4
In practical terms the difference isn't worth the time it takes to discuss it.
+ 1
I++ is faster!
+ 1
yes' very hard" but technically speaking it is matter of mechine cycle's i=i+1 will take 2 mechine cycle's means 24 clock cycles but i++ take one mechine cycle 12 clock cycles so it is faster in execution when compared to other this same is applicable for other pre and post Inc/Dec instructions
0
good winkyihtut but what is reason behind it??could you explain for me
0
actually i got this question in an interview that's why i know @ very hard