![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Appendix C: | Operator Precedence |
The following table lists C's precedence and associativity characteristics. Each box contains operators with equal precedence. The table is arranged such that the higher the box in the table, the higher the operator in precedence.
Operator level | Associativity | |||
( ) [ ] -> . | left to right | |||
sizeof(data type) | ||||
! ~ ++ -- | right to left | |||
+ (unary) - (unary) | ||||
* (dereference) & (address of) | ||||
(data type) | ||||
* / % | 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 | |||
Note that each data type, surrounded by parentheses, is considered an operatornamely, a casting operator. Also, the parentheses following a function name are considered to be the function-call operator.