Precedence

From C

Jump to: navigation, search

Precedence of operators

Operators Associativity Description
() [] -> . left to right function calls, subscript, pointer member, structure member
! ~ ++ -- + -

(type) * & sizeof

right to left unary operators
* / % left to right multiplicative
+ - left to right additive
<< >> left to right shift
< <= > >= left to right relational
== != left to right equality
& left to right bitwise AND
^ left to right bitwise XOR
| left to right bitwise OR
&& left to right logical AND
|| left to right logical OR
?: right to left conditional
= += -= *= /= %=

<<= >>= &= ^= |=

right to left assignment
, left to right comma

The # and ## operators are part of the preprocessor phase and do not participate in operator precedence.

External links

HTML table with explanations


Category Language

Personal tools