| Level |
Operators |
Note |
| 1 (highest) |
() [] -> . postfix++ --
|
always wins |
| 2 |
prefix++ -- * & ! ~ sizeof
|
rightβleft |
| 3β4 |
* / % + -
|
arithmetic |
| 5 |
<< >>
|
shifts |
| 6β7 |
< <= >= > == !=
|
== is above & ! |
| 8 |
& |
bitwise AND |
| 9 |
^ |
bitwise XOR |
| 10 |
| |
bitwise OR |
| 11β12 |
&& ||
|
logical |
| 14 (lowest) |
= += -= β¦ |
assignment |
// TRAP β == binds tighter than &
val & 0x01 == 0 // β val & (0x01==0) β val & 0 β always 0!
(val & 0x01) == 0 // correct
// TRAP β postfix++ beats *
*p++ // β *(p++) β deref old p, then advance
(*p)++ // increment the value p points to