0% found this document useful (0 votes)
28 views

C++ Operator Precedence: Operator Associativity Overloadable Arity Description

This document describes the operator precedence in C++. It lists the operators from highest to lowest precedence and provides details on their associativity, overloadability, arity, and descriptions. The highest precedence operators are ::, ., and -> which are used for scoping. Lowest precedence is given to assignment operators and comma operator.

Uploaded by

MostafaElBaz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views

C++ Operator Precedence: Operator Associativity Overloadable Arity Description

This document describes the operator precedence in C++. It lists the operators from highest to lowest precedence and provides details on their associativity, overloadability, arity, and descriptions. The highest precedence operators are ::, ., and -> which are used for scoping. Lowest precedence is given to assignment operators and comma operator.

Uploaded by

MostafaElBaz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

C++ Operator Precedence

Operator
::
::

Associativity
right
left

Overloadable
no
no

Arity
unary
binary

Description______________
global scope
class scope

.
->
[]
()
()

left
left
left
left
left

no
yes
yes
yes
yes

binary
binary
binary
n/a
n/a

direct member selection


indirect member selection
subscript (array index)
function call
type construction

sizeof
++ -!
+*
&
new
delete
()

right
right
right
right
right
right
right
right
right

n/a
yes
yes
yes
yes
yes
yes
yes
yes

unary
unary
unary
unary
unary
unary
unary
unary
binary

size in bytes of object or type


increment, decrement
logical NOT
plus, minus signs
pointer dereferencing
get address of an object
memory allocation
memory deallocation
type conversion (cast)

* / %

left

yes

binary

multiplication, division, modulus

+-

left

yes

binary

addition, subtraction

<< >>

left

yes

binary

bit-shift left, right

< <= > >=

left

yes

binary

comparison

== !=

left

yes

binary

equality, inequality

&
^
|

left
left
left

yes
yes
yes

binary
binary
binary

bitwise AND
bitwise XOR
bitwise OR

&&
||

left
left

yes
yes

binary
binary

logical AND
logical OR

?:

right

no

ternary

conditional expression

= += -=
*= /= %=
&= |= ^=

right

yes

binary

assignment variations

throw

right

yes

binary

throw an exception

left

yes

binary

expression separation

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy