Operator Precedence Table in C++

The operator precedence table in C++ is a table that lists the operators in order of their precedence level. Operators with higher precedence are evaluated before operators with lower precedence. This table also includes the associativity of the operators, which determines the order in which operators of the same precedence are processed.

The operators are listed from top to bottom, in descending precedence

OperatorNameAssociativity
() [] -> .Function call, Subscript, Member accessLeft
++ —Increment/DecrementRight
! ~ – +Logical/Bitwise NOT, Unary plus/minusRight
* / %Multiplication, Division, ModulusLeft
+ –Addition, SubtractionLeft
<< >>Bitwise shiftLeft
< <= > >=Relational operatorsLeft
== !=Equality operatorsLeft
&Bitwise ANDLeft
^Bitwise XORLeft
|Bitwise ORLeft
&&Logical ANDLeft
||Logical ORLeft
?:Ternary conditionalRight
= += -= *= /= %= &= ^= |= <<= >>=Assignment and compound assignmentRight
,CommaLeft




Operator Precedence and Associativity in C++

In C++,operator precedence and associativity are important concepts that determine the order in which operators are evaluated in an expression. Operator precedence tells the priority of operators, while associativity determines the order of evaluation when multiple operators of the same precedence level are present.

Similar Reads

Operator Precedence in C++

In C++, operator precedence specifies the order in which operations are performed within an expression. When an expression contains multiple operators, those with higher precedence are evaluated before those with lower precedence....

Operator Associativity in C++

Operator associativity determines the order in which operands are grouped when multiple operators have the same precedence. There are two types of associativity:...

Operator Precedence Table in C++

The operator precedence table in C++ is a table that lists the operators in order of their precedence level. Operators with higher precedence are evaluated before operators with lower precedence. This table also includes the associativity of the operators, which determines the order in which operators of the same precedence are processed....

Contact Us