5.0 Expressions 441
== Equality Left to right
!= Inequality
& Bitwise AND Left to right
^ Bitwise XOR Left to right
| Bitwise OR Left to right
&& Logical AND Left to right
|| Logical OR Left to right
?: Conditional Right to left
=
*= /= %=
+=-=&= Assignment operators Right to left
^= |=
<<= >>=
, Comma operator Right to left
As an example of how to use Table A.5, consider the following expression:
b | c & d * e
The multiplication operator has higher precedence than both the bitwise OR and bit-
wise AND operators because it appears above both of these in Table A.5. Similarly, the
bitwise AND operator has higher precedence than the bitwise OR operator because the
former appears above the latter in the table.Therefore, this expression is evaluated as
b | ( c & ( d * e ) )
Now consider the following expression:
b % c * d
Because the modulus and multiplication operator appear in the same grouping in Table
A.5, they have the same precedence.The associativity listed for these operators is left to
right, indicating that the expression is evaluated as
( b % c ) * d
As another example, the expression
++a->b
is evaluated as
++(a->b)
because the ->operator has higher precedence than the ++operator.
Ta ble A.5 Continued
Operator Description Associativity
20 0672326663 AppA 6/10/04 2:01 PM Page 441