# Operator Precedence

The following tables show the order in which operators are evaluated. Please note the following.

- The order in which the operands are evaluated is not specified in the ANSII standard.
- For readability you should not rely on these rules! Put everything in brackets so you intension is clear to the compiler and other programmers.

Summary table.
Table in detail.
Operators listed by type.

## Summary precedence table.

All operators on the same line have the same precedence. The first line has the highest precedence.

() | [] | -> | .
! | ~ | ++ | -- | + | - | * | & | sizeof
* | / | %
+ | -
<< | >>
< | <= | >= | >
== | !=
&
^
&&
?:
= | += | -= | *= | /= | %= | &= | ^= | |= | <<= | >>=
,

Lary Huang has told me that the postfix unary -- and postfix unary ++ have a higher precedence than the prefix unary -- and prefix unary ++.

## Detailed precedence table.

All operators in the same 'block' have the same precedence. The first block has the highest precedence.

Group | Operator | Description | Example
Membership.
| () | Function call. | count = function(4,3);
| [] | Array. | value = array[5] + increment;
| -> | Structure pointer.
| . | Structure member.
Unary.
| ! | Logical NOT
| ~ |
| ++ | Increment.
| -- | Decrement.
| + |
| -
| * | Pointer to data
| & | Address of a variable.
| sizeof
| (type) | type cast.
Binary.
| * | Multiply.
| / | Divide.
| % | Modulo.
Binary.
| + | Addition
| - | Subtraction.
Bitwise
| << | Shift left.
| >> | Shift Right.
Relational.
| < | Less than.
| > | Greater than.
| <= | Less than or equal too.
| >= | Greater than or equal too.
| == | Equal too.
| != | Not equal too.
More Bitwise
| & | bitwise AND
| ^ | bitwise Excusive OR
| | | bitwise OR
Logical.
| && | Logical AND
Logical.
| || | Logical OR
Conditional
| ? : | Conditional construct.
Assignment
| = | Equals
| += | assignment
| -= | assignment
| *= | assignment
| /= | assignment
| %= | assignment
| &= | assignment
| ^= | assignment
| |= | assignment
| <<= | assignment
| >>= | assignment
Series
| , | Comma

## See also:

Expressions and operators.
Assignment Operators.

Top | Master Index | Keywords | Functions