Expressions with Unary Operators
Unary operators act on only one operand in an expression. The unary operators are:
These operators have right-to-left associativity. Unary expressions generally involve syntax that precedes a postfix or primary expression.
The following are the possible forms of unary expressions:
postfix-expression ++unary-expression ––unary-expression unary-operator cast-expression sizeof .unary-expression sizeof ( type-name ) allocation-expression deallocation-expression
The unary-operator may be one of
* & + – ! ~
Any postfix expression is considered a unary expression, and since any primary expression is considered a postfix expression, all primary expressions are considered unary expressions as well. For more information, see Postfix Expressions and Primary Expressions.
The allocation-expression refers to the new operator. The deallocation-expression refers to the delete operator. See the links above.
The cast-expression is a unary expression with an optional cast to alter the type. For more information see Cast Operator: ().