1.5.6 Precedence
The operators have a set order of precedence during evaluation. Items encapsulated in parenthesis are evaluated first and have the highest precedence. The following chart shows the order of precedence with the items at the top having highest precedence.
Operator | Name |
---|---|
! | Logical NOT. Bang. |
++ — | Increment and decrement operators. |
* / % | Multiplicative operators. |
+ – | Additive operators. |
<< >> | Shift operators. |
< > <= >= | Inequality comparators. |
== != | Equality comparators |
& | Bitwise AND. |
^ | Bitwise XOR. |
| | Bitwise OR. |
&& | Logical AND. |
|| | Logical OR. |
?: | Conditional. |
= op= | Assignment. |
17 * 5 + !(1+1) && 0
Evaluates to 0 (false).
5+7<4
Evaluates to 1 (true).
a<b<c
Same as (a<b)<c.