C++ Operator Precedence and Associativity
This page lists C++ operators in order of precedence (highest to lowest). Their associativity
indicates in what order operators of equal precedence in an expression are applied.
Operator Description Associativity
() Parentheses Not applicable
Function call Call to functions left-to-right
[] Array index
. Member selection via object name
-> Member selection via pointer
++ -- Postfix increment/decrement
++ -- Prefix increment/decrement right-to-left
sizeof Determine size in bytes
+ - Unary plus, minus
! Logical negation
& Address
* Dereference/Indirection
(type) Cast (change type)
* / % Multiplication, division, modulus left-to-right
+ - Addition and subtraction left-to-right
< <= Relational less than, less than or equal to left-to-right
> >= Relational greater than, greater than or equal to
== != Equal to, Not equal to left-to-right
&& Logical AND left-to-right
|| Logical OR left-to-right
?: Conditional right-to-left
= Assignment right-to-left
+= -= Addition, subtraction assignment
*= /= Multiplication, division assignment
%= Modulus assignment
, Comma left-to-right