+ 3

What is the difference between ++x and x++ in processing

28th May 2017, 7:56 AM
Vansh Wadhwa
Vansh Wadhwa - avatar
6 Answers
+ 11
++x is pre increment. y = ++x means x = x + 1 and y = x Ex. x = 5; y = ++x means x = 6 and y = 6 x++ is post increment. y = x++ means y = x and x = x + 1 Ex. x = 5; y = x++ means y = 5 and x = 6
28th May 2017, 8:03 AM
Krishna Teja Yeluripati
Krishna Teja Yeluripati - avatar
28th May 2017, 8:05 AM
Thanh Le
Thanh Le - avatar
+ 3
https://code.sololearn.com/W7X805sc4DPC/?ref=app
28th May 2017, 11:24 AM
Mario L.
Mario L. - avatar
+ 2
I'm not that good with c++ but in other languages: x++ increments x by 1 after this row is executed ++x incrmenets x by 1 right after it is written so: var x=5; echo x++; //will print 5 echo x; //will print 6 var x =5; exho ++x //will print 6 Again, idk commands for c++ but you get the point.
28th May 2017, 8:04 AM
Amar
Amar - avatar
+ 2
x++ goes like {temp = x; x = x + 1; return temp;} and ++x goes like {x = x + 1; return x;} obviously these are pseudo codes. The semantics remain same.
28th May 2017, 8:05 AM
Venkatesh Pitta
Venkatesh Pitta - avatar
+ 2
thanks all
28th May 2017, 8:07 AM
Vansh Wadhwa
Vansh Wadhwa - avatar