Operator Precedence and Associativity Table

This table lists the C and C++ language operators in order of precedence and shows the direction of associativity for each operator. In C++, the primary scope resolution operator (::) has the highest precedence, followed by the other primary operators. In C, because there is no scope resolution operator, the other primary operators have the highest precedence. The comma operator has the lowest precedence. Operators that appear in the same group have the same precedence.

Operator Name  Associativity  Operators
Primary scope resolution left to right ::
Primary   left to right  ()  [ ]  .  -> dynamic_cast typeid
Unary  right to left  ++  --  +  -  !  ~  &  *  (type_name)  sizeof new delete
C++ Pointer to Member left to right .*->*
Multiplicative  left to right  *  /  %
Additive  left to right  +  -
Bitwise Shift  left to right  <<  >>
Relational  left to right  <  >  <=  >=
Equality  left to right  ==  !=
Bitwise AND  left to right  &
Bitwise Exclusive OR  left to right  ^
Bitwise Inclusive OR  left to right  |
Logical AND  left to right  &&
Logical OR  left to right  ||
Conditional  right to left  ? :
Assignment  right to left  =  +=  -=  *=   /=  <<=  >>=  %=   &=  ^=  |=
Comma  left to right  ,

 



Expressions and Operators
Types of Expressions


Primary Operators
Unary Operators
Binary Operators
Conditional Operator
Assignment Operators
Comma Operator