Operator(s) | Description | Associativity |
---|---|---|
:: |
Scope resolution (C++ only) | N/A |
++ -- () [] . -> |
Postfix increment and decrement Function call Array subscript Element selection by reference Element selection by pointer |
Left-to-Right |
++ -- |
Prefix increment and decrement | Right-to-Left |
= |
Assignment | Right-to-Left |
*= |
Multiplication Assignment | Right Left |
/= |
Division assignment | Right-to-Left |
+ - |
Unary plus and minus | Right-to-Left |
! |
Logical NOT | N/A |
(type) |
Type cast | Right-to-Left |
* |
Indirection (dereference) | N/A |
& |
Address-of (reference) | N/A |
sizeof() |
Size-of-type | N/A |
sizeof |
Size of object | N/A |
delete |
Dynamic memory (de-)allocation (C++ only) | N/A |
.* ->* |
Pointer to member (C++ only) | Left-to-Right |
% |
modulus (remainder) | Left-to-Right |
* / |
Multiplication, division, and | Left-to-Right |
<< >> |
Bitwise left shift and right shift | Left-to-Right |
+ - |
Addition and subtraction | Left-to-Right |
< <= > >= |
Relational “less than” and “less than or equal
to” Relational “greater than” and “greater than or equal to” |
Left-to-Right |
== |
Relational “equal to” | Left-to-Right |
!= |
and “not equal to” | Left-to-Right |
&= |
Bitwise AND assignment | Left-to-Right |
^ |
Bitwise XOR (exclusive or) | Left-to-Right |
| |
Bitwise OR (inclusive or) | Left-to-Right |
&& |
Logical AND | Left-to-Right |
|| |
Logical OR | Left-to-Right |
c?t:f |
Ternary conditional (see ?:) | Right-to-Left |
= += -= *= /= %= <<= >>= &= ^= |= |
Direct assignment Assignment by sum and difference Assignment by product, dividend, and remainder Assignment by bitwise shift Assignment by bitwise AND, XOR, and OR |
|
, |
Comma | Left-to-Right |