You are on page 1of 1

C/C++ Operator Precedence

Precedence
1
2

4
5
6
7
8

9
10
11
12
13
14
15
16

17
18

Operators

Description

Associativity

::
++
-()
[]
.
->
typeid()
const_cast
dynamic_cast
reinterpret_cast
static_cast
++
-+
!
~
(type)
*
&
sizeof
new, new[]
delete, delete[]
.*
->*
*
/
%
+
<<
>>
<
<=
>
>=
==
!=
&
^
|
&&
||
?:
=
+=
-=
*=
/=
%=
<<=
>>=
&=
^=
|=
throw
,

Scope resolution (C++ only)


Sux increment
Sux decrement
Function call
Array subscript
Element selection
Element selection by pointer
Runtime type information (C++ only)
Type cast (C++ only)
"
"
"
Prefix increment
Prefix decrement
Unary plus
Unary minus
Logical NOT
Bitwise NOT
Type cast
Indirection (pointer dereference)
Address-of
Size-of
Dynamic memory allocation (C++ only)
Dynamic memory deallocation (C++ only)
Pointer to member (C++ only)
Pointer to dereferenced member (C++ only)
Multiplication
Division
Integer modulus (remainder)
Addition
Subtraction
Bitwise shi le
Bitwise shi right
Less than
Less than or equal to
Greater than
Greater than or equal to
Equal to
Not equal to
Bitwise AND
Bitwise XOR (exclusive or)
Bitwise OR (inclusive or)
Logical AND
Logical OR
Ternary conditional
Assignment
Assignment by sum
Assignment by dierence
Assignment by product
Assignment by quotient
Assignment by remainder
Assignment by bitwise le shi
Assignment by bitwise right shi
Assignment by bitwise AND
Assignment by bitwise XOR
Assignment by bitwise OR
row an exception
Sequence

Le to right
Le to right

bw.org/contact

Right to le

Le to right
Le to right
Le to right
Le to right
Le to right

Le to right
Le to right
Le to right
Le to right
Le to right
Le to right
Right to le
Right to le

Right to le
Le to right

You might also like