() [] ++ -- |
Parentheses (function call) (see Note 1) Brackets (array
subscript) Postfix increment/decrement (see Note 2) |
left-to-right |
++
-- + - !
& |
Prefix increment/decrement Unary plus/minus Logical
negation Address |
right-to-left |
* /
% |
Multiplication/division/modulus |
left-to-right |
+ - |
Addition/subtraction |
left-to-right |
<
<= > >= |
Relational less than/less than or equal to Relational greater
than/greater than or equal to |
left-to-right |
== != |
Relational is equal to/is not equal to |
left-to-right |
&& |
Logical AND |
left-to-right |
|| |
Logical OR |
left-to-right |
= +=
-= *= /= |
Assignment Addition/subtraction
assignment Multiplication/division assignment |
right-to-left |
, |
Comma (separate expressions) |
left-to-right |
- Note 1:
- Parentheses are also used to group sub-expressions to force
a different precedence; such parenthetical expressions can be
nested and are evaluated from inner to outer.
- Note 2:
- Postfix increment/decrement have high precedence, but the
actual increment or decrement of the operand is delayed (to be
accomplished sometime before the statement completes execution).
So in the statement y =
x * z++; the current value of z is used to evaluate the
expression (i.e., z++
evaluates to z) and z only incremented after all
else is done. See postinc.c
for another example.
|