2.3.16.1. - Unary Operators
Unary operators have equal precedence, are evaluated right to left and have higher precedence than the binary operators.
Operator | Name | Result |
|
||
- |
Unary minus | Negative of operand. |
+ |
Unary plus | Operand. |
! |
Logical negation | 1 if operand is zero, 0 otherwise. |
++ |
Increment | Increment the operand by one. |
-- |
Decrement | Decrement the operand by one. |
~ |
Bitwise not | One's complement of operand. (A tilde.) |
When used as prefix operators,
++
and
--
operate before the result is used in the expression.
When used as postfix operators, the
++
and
--
operations are done after the current value of the operand
is used in the expression.