ano (C++ Operator Precedence cppreference.com
C++ Operator Precedence
The following table lists the precedence and associativity of C++ operators. Operators are listed top to
bottom, in descending precedence.
Precedence|Operator Description ‘Associativity
Fy i Scope resolution Left-to-right
= Suffix/postfix increment and decrement
0 Function call
2 u ‘Array subscripting
Element selection by reference
> Element selection through pointer
i Prefix increment and decrement Right-to-left
. Unary plus and minus
be Logical NOT and bitwise NOT
(type) ‘Type cast
3 * Indirection (dereference)
6 ‘Address-of
sizeof Size-of
new, newl] Dynamic memory allocation
delete,
deletel]
~ Pointer to member Left-to-right
~ Ts Multiplication, division, and remainder
- ‘Addition and subtraction
<> Bitwise left shift and right shift
For relational operators < and = respectively
For relational operators > and = respectively
For relational = and # respectively
lo (é Bitwise AND
mu Bitwise XOR (exclusive or)
12 i Bitwise OR (inclusive or)
13 (6s Logical AND
wil Logical OR
7 Ternary conditional] Right-to-left
= Direct assignment (provided by default for C++ classes)
‘Assignment by sum and difference
‘Assignment by product, quotient, and remainder
‘Assignment by bitwise left shift and right shift
‘Assignment by bitwise AND, XOR, and OR
16 ‘Throw operator (for exceptions)
v7, Comma Left-to-right
Dynamic memory deallocation
sion e
4s
[11The expression in the middle of the conditional operator (between ? and :) is parsed as if
parenthesized: its precedence relative to ?: is ignored,
When parsing an expression, an operator which is listed on same row will be bound tighter (as if by
parentheses) to its arguments than any operator that is listed on a row further below it. For example, the
expressions std::cout<