C++ Operator Precedence Chart   (highest on top)

Level Operator(s) Description Associativity
17
::name global scope (unary)
right-to-left
17
class_name::member
namespace_name::member
class scope (binary)
namespace scope (binary)
left-to-right
16
pointer->member
object.member
member selectors
left-to-right
16
array_name[ expr ]
pointer[ expr ]
array index
left-to-right
16
expr( expr_llist ) function call
left-to-right
16
type( expr_list ) value construction
left-to-right
16
typeid( type ) type identification
left-to-right
16
typeid( expr ) runtime type identification
left-to-right
16
dynamic_cast< type >( expr )
runtime checked conversion
left-to-right
16
static_cast< type >( expr )
compiletime checked conversion
left-to-right
16
reinterpret_cast< type>( expr )
unchecked conversion
left-to-right
16
const_cast< type >( expr )
const conversion
left-to-right
15
sizeof( expr ) size of object in bytes
left-to-right
15
sizeof( type ) size of type in bytes
left-to-right
15
lvalue++
lvalue--
postfix increment, decrement
right-to-left
15
~expr bitwise NOT (complement)
right-to-left
15
!expr logical NOT
right-to-left
15
+expr
-expr
unary plus
unary minus
right-to-left
15
*expr
&lvalue
dereference, address-of
right-to-left
15
( type ) expr cast (type conversion)
right-to-left
15
new type
delete pointer
delete [] pointer
free store management
right-to-left
14
pointer->*pointer_to_member

object.*pointer_to_member
member pointer selectors
left-to-right
13
expr * expr
expr / expr
expr % expr
multiplicative operators
left-to-right
12
expr + expr
expr - expr
arithmetic operators
left-to-right
11
expr << expr
expr >> expr
bitwise shift
left-to-right
10
expr < expr
expr <= expr
expr > expr
expr >= expr
relational less than
relational less than or equal
relational greater than
relational greater than or equal
left-to-right
9
expr == expr
expr != expr
equality,
inequality
left-to-right
8
expr & expr bitwise AND
left-to-right
7
expr ^ expr bitwise exclusive OR
left-to-right
6
expr | expr bitwise inclusive OR
left-to-right
5
expr && expr logical AND
left-to-right
4
expr || expr logical OR
left-to-right
3
expr ? expr : expr arithmetic if
left-to-right
2
lvalue = expr
lvalue *= expr

/= %= += -= <<= >>= &= |= ^=
simple assignment
multiply and assign

all other multiplicative, shift, and bitwise assignment operators
right-to-left
1
expr , expr comma operator (sequencing)
left-to-right