what is the difference between x++ and ++x | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

what is the difference between x++ and ++x

15th Sep 2016, 11:44 AM
Cody Arthur
Cody Arthur - avatar
5 Answers
+ 7
X++ evaluate expression and then increment it ++X increment expression before evaluating it. for example : int x =0; if(x++==0) X is compared to 0 before being incremented, it is true. if(++x==0) X is incremented first and then compared to 0, it is false.
15th Sep 2016, 11:55 AM
basslo81
basslo81 - avatar
0
First one is post increment and second is pre increment
15th Sep 2016, 5:05 PM
manan Kanswal
0
Post increment and pre increment
16th Sep 2016, 2:34 AM
Franco Muñiz
Franco Muñiz - avatar
0
I dont know
29th Sep 2016, 4:40 PM
o_o