Rules for ++ and – operators:
Following are the rules for the increment (++) and decrement (–) operators.
- Increment (++) and decrement (–) operators are unary operators and they require variable as their operands.
- When postfix ++ (or –) is used with a variable in an expression, the expression is evaluated first using the original value of the variable and then the variable is incremented (or decremented) by one.
- When prefix ++ (or –) is used in an expression, the variable is incremented (or decremented) first and then the expression is evaluated using the new value of the variable.
![](https://1.bp.blogspot.com/-4JPZmroUuDs/VT5k70Bx5JI/AAAAAAAACAg/x3G7AKa9W94/s1600/unnamed.png)
The precedence and associatively of ++ and –operators are the same as those of unary + and unary -.