|

| |
“Whosoever
therefore shall humble himself as this little child, the
same is greatest in the kingdom of heaven.
Whosoever shall exalt himself shall be abased; and he
that shall humble himself shall be exalted.
” - Jesus |
Operator precedence
can be tricky sometimes, when combining indirection, mathematical,
logical and relational
operators:
|
Rank |
Name |
|
Operator |
|
1 |
scope resolution |
|
:: |
| 2 |
parentheses, member selection, subscripting,
function calls, postfix increment/decrement
|
|
-> . ( ) ++ -- |
| 3 |
sizeof, prefix increment/decrement, and, not, unary
minus/plus, address of and dereference, new, delete,
casting |
|
++ -- ^ ! - +
&
* ( ) |
| 4 |
member * operators, precedence> |
|
|
| 5 |
multiply, divide, modulo |
|
*
/ % |
| 6 |
add, subtract |
|
+
- |
| 7 |
shift |
|
<< >> |
| 8 |
inequality, relational |
|
<
<= > >= |
| 9 |
equality, inequality |
|
== != |
|
10 |
bitwise AND |
|
& |
|
11 |
bitwise exclusive OR |
|
^ |
|
12 |
bitwise OR |
|
| |
|
13 |
logical AND |
|
&& |
|
14 |
logical OR |
|
|| |
|
15 |
conditional |
|
?: |
|
16 |
assignment operators |
|
+= -= <<= >>=
&=
|= ^= |
|
17 |
throw operator |
|
throw |
|
18 |
comma |
|
, |
©2004 C. Germany
|