description | title | ms.date | helpviewer_keywords | ms.assetid | |||
---|---|---|---|---|---|---|---|
Learn more about: Expressions with Unary Operators |
Expressions with Unary Operators |
11/04/2016 |
|
1217685b-b85d-4b48-9ff4-d90f56a26c1b |
Unary operators act on only one operand in an expression. The unary operators are as follows:
These operators have right-to-left associativity. Unary expressions generally involve syntax that precedes a postfix or primary expression.
unary-expression
:
postfix-expression
++
cast-expression
--
cast-expression
unary-operator
cast-expression
sizeof
unary-expression
sizeof
(
type-id
)
sizeof
...
(
identifier
)
alignof
(
type-id
)
noexcept-expression
new-expression
delete-expression
unary-operator
: one of
*
&
+
-
!
~
Any postfix-expression
is considered a unary-expression
, and because any primary-expression
is considered a postfix-expression
, any primary-expression
is considered a unary-expression
also. For more information, see Postfix expressions and Primary expressions.
The cast-expression
is a unary-expression
with an optional cast to change the type. For more information, see Cast operator: ()
.
The noexcept-expression
is a noexcept-specifier
with a constant-expression
argument. For more information, see noexcept
.
The new-expression
refers to the new
operator. The delete-expression
refers to the delete
operator. For more information, see new
operator and delete
operator.