+ 1
what is the difference between x++ and ++x
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.
0
First one is post increment and second is pre increment
0
Post increment and pre increment
0
I dont know