Expressions with Unary Operators
Visual Studio .NET 2003
Unary operators act on only one operand in an expression. The unary operators are:
- Indirection operator (*)
- Address-of operator (&)
- Unary plus operator (+)
- Unary negation operator (–)
- Logical negation operator (!)
- One's complement operator (~)
- Prefix increment operator (++)
- Prefix decrement operator (––)
- Cast Operator ()
- sizeof operator
- __uuidof operator
- __alignof operator
- new operator
- delete operator
These operators have right-to-left associativity.
Grammar
- unary-expression :
- postfix-expression
++unary-expression
––unary-expression
unary-operator cast-expression
sizeof .unary-expression
sizeof ( type-name )
allocation-expression
deallocation-expression - unary-operator : one of
- * & + – ! ~