+ 3
What is a difference between ++x and x++?
7 Answers
+ 8
a = x++ means assign the value of x to a, then increment x.
a = ++x means increment x, then assign the incremented value to a
+ 5
Like,
x=2;
cout<<++x<<newl;
cout<<x;
\\print 3 and 3
Now:
x=2;
cout<<x++;
cout<<x;
//print 2 and 3
+ 2
++x means at that moment the value +1 whereas x++ means when we use the value next time it is increased by 1
+ 1
++x is prefix increment operation which follows the "change then use" rule which means that ++x will first increment the value of x by 1 and then use it whereas x++ is postfix increment operation which follows the "use then change rule" which means that the value of variable 'x' will be first used and then incremented
0
preincrement and posrimcrement
0
one is increment operator and the other one is decrement operator.
- 2
preincrement and postincrement



