Precedence and Associativity of Operators

Table 1 summarizes the rules for precedence and associativity of all operators. Operators on the same line have the same precedence; rows are in order of decreasing precedence, so, for example, *, /, and % all have the same precedence, which is higher than that of binary + and -.

Operators Associativity
() [] -> .  left to right
! ~ ++ -- + - * & (type) sizeof  right to left
* / %  left to right
+ -  left to right
<<  >>  left to right
< <= > >=  left to right
== !=  left to right
&  left to right
^  left to right
|  left to right
&&  left to right
||  left to right
?:  right to left
= += -= *= /= %= &= ^= |= <<= >>=  right to left
,  left to right

Unary &, +, -, and * have higher precedence than the binary forms.

Table 1: Precedence and Associativity of Operators