Appendix . Inside Back Cover

Operator precedence and associativity

Operator

Associativity

::

Left to Right

++ -- () [].

-> typeid()

const_cast

dynamic_cast

reinterpret_cast

static_cast ++ --

+ - ! ~ (type)

* & sizeof new

new[] delete

delete[]

Right to Left

.* ->*

* / %

+ - (Arithmetic plus and minus)

<< >>

< <=

> >=

== !=

& (Bitwise AND)

^

|

&&

||

c?t:f (ternary operator)

Left to Right

=

+= -=

*= /= %=

<<= >>=

&= ^= |=

Right to Left

throw

Not Applicable

,

Left to Right

Operators at the top of the table have higher precedence than operators below. In expressions beginning with arguments in the innermost set of parentheses (if any), programs evaluate operators of higher precedence before evaluating operators of lower precedence. In the absence of clarifying parentheses, ...

Get Sams Teach Yourself C++ in One Hour a Day, Sixth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.