+ 3
About x++, x+
can someone plz tell me what's the difference between x+ and x++?
3 Answers
+ 2
9 :) I guess
- 1
when u encounter ++x, first increase x value with 1 then do any operations on that statement . hence called pre increment.
when u encounter x++, first perform operations on that statement for x without bothering about increment but after that statement x value will be increment by 1. hence post increment
example: x=5;
y=++x + x++;
y will be 12 as y=6 + 6
but after this statement x becomes 7
now answer this
int x=6;
int y=++x - x++ + ++x;
cout<<y;
cout<<x;
- 1
y=7-7+8
so y= 8
and thrice increment on x makes it 9



