C++ Built-in Operators, Precedence and Associativity
The latest version of this topic can be found at C++ Built-in Operators, Precedence and Associativity.
The C++ language includes all C operators and adds several new operators. Operators specify an evaluation to be performed on one or more operands.
Operator precedence specifies the order of operations in expressions that contain more than one operator. Operator associativity specifies whether, in an expression that contains multiple operators with the same precedence, an operand is grouped with the one on its left or the one on its right. The following table shows the precedence and associativity of C++ operators (from highest to lowest precedence). Operators with the same precedence number have equal precedence unless another relationship is explicitly forced by parentheses.
C++ Operator Precedence and Associativity
|Member selection (object or pointer)|
|Constant type conversion|
|Dynamic type conversion|
|Reinterpreted type conversion|
|Static type conversion|
|Size of object or type|
|Pointer-to-member (objects or pointers)|
|Less than or equal to|
|Greater than or equal to|
|Bitwise exclusive OR|
|Bitwise inclusive OR|
|Bitwise AND assignment|
|Bitwise inclusive OR assignment|
|Bitwise exclusive OR assignment|