'C' precedence and associativity of operators

I'm posting this here because personally I never know when I'm going to need it. As even some airline pilots have to write Port & Starboard on their thumbs I guess that I'm in good company. Anyway I've seen enough bugs caused by false assumptions on how an expression is going to associate to last a life time :- foo << bah & 0xf gets them every time!
 
 
 

()  []  ->  .
->
!  ~  ++  --  +  -  *  &  (type)  sizeof 
+ - * are unary forms ie.  -72 => (0 - 72), * => ptr
<-
*  /  % 
->
+  - 
+ - are binary ie. used for arithmetic
->
<<  >>
->
<  <=  >  >=
->
==  !=
->
&
->
^
->
|
->
&&
->
||
->
? :
<-
=  +=  -=  *=  /=  %=  &=  ^=  |=  <<=  >>=
<-
,
->


[ Home ]            [ Contact us ]