Skip to content

Latest commit

 

History

History
29 lines (26 loc) · 2.29 KB

precedence.md

File metadata and controls

29 lines (26 loc) · 2.29 KB

C/C++ Operator Precedence

⬅ means right-to-left associative, everything else is left-to-right associative.

1. Scope resolution ::
2. Postfix unary a++, a(), a.b, a[], ...
3. ⬅ Prefix unary ++a, *a, (T), sizeof, co_await, new, ...
4. Pointer-to-member .*, ->*
5. Multiplicative *, /, %
6. Additive +, -
7. Bitwise shift <<, >>
8. Three-way comparison <=>
9. Relational <, <=, >, >=
10. Equality ==, !=
11. Bitwise AND &
12. Bitwise XOR ^
13. Bitwise OR |
14. Logical AND &&
15. Logical OR ||
16. ⬅ Others, assignment ?:, throw, co_yield, =, +=, ...
17. Comma ,

See Also

<:cppreference:875716540929015908> Order of evaluation
<:cppreference:875716540929015908> C Operator Precedence