Previous Section
 < Free Open Study > 
Next Section


Appendix B: Operator Precedence

The following table summarizes C++ operator precedence. In the table, the operators are grouped by precedence level (highest to lowest), and a horizontal line separates each precedence level from the next-lower level. In general, the binary operators group from left to right; the unary operators, from right to left; and the ? : operator, from right to left. Exception: The assignment operators group from right to left.

Precedence (highest to lowest)

Operator

Associativity

Remarks

::

Left to right

Scope resolution (binary)

::

Right to left

Global access (unary)

()

Left to right

Function call and function-style cast

[] -> .

Left to right

 

++ --

Right to left

++ and -- as postfix operators

typeid dynamic_cast

Right to left

 

static_cast const_cast

Right to left

 

reinterpret_cast

Right to left

 

++ -- ! Unary + Unary -

Right to left

++ and -- as prefix operators

~ Unary * Unary &

Right to left

 

(cast) sizeof new delete

Right to left

 

->* .*

Left to right

 

* / %

Left to right

 

+ -

Left to right

 

<< >>

Left to right

 

< <= > >=

Left to right

 

== !=

Left to right

 

&

Left to right

 

^

Left to right

 

|

Left to right

 

&&

Left to right

 

||

Left to right

 

? :

Right to left

 

= += -= *= /= %=

Right to left

 

<<= >>= &= |= ^=

Right to left

 

throw

Right to left

 

,

Left to right

The sequencing operator, not the separator



Previous Section
 < Free Open Study > 
Next Section
Converted from CHM to HTML with chm2web Pro 2.85 (unicode)