These operators modify the values of an expression by adding and subtracting 1.
Operator | Description | Initial value of x | Expression | Final value of y | Final value of x |
++x | Pre Increment | 5 | y = ++x; | 6 | 6 |
x++ | Post Increment | 5 | y = x++; | 5 | 6 |
--x | Pre Decrement | 5 | y = --x; | 4 | 4 |
x-- | Post Decrement | 5 | y = x--; | 5 | 4 |
Ask Question