[WPI] [cs2223] [cs2223 text] [News] [Notes] 

cs2223, D97/98

Precedence and Associativity of C and C++ Operators


Precedence is top (highest) to bottom. All operators associate left to right except those in the three rows marked R/L. Operators specific to C++ are shown in red. A text version is available.


:: (the unary form associates R/L)
( )  [ ]  ->  . 
R/L
++  --  +  -  !  ~  (cast)  * &  sizeof
 .*  ->*
*  /  %
+  -
<< >>
<  <=  >  >=
==  !=
&
^
|
&&
||
R/L
? :
R/L
=  +=  -=  *=  /=  %=  &=  ^=  !=  <<=  >>=
 , 

 

--------------------
[WPI Home Page] [cs2223 home page]  [cs2223 text] [News] [Notes] 

Contents ©1994-1998, Norman Wittels
Updated 14Mar98