運算元優先順序及結合率

Precedence Operation Associativity
1 a[..] f(..) . -> left
2* postfix ++  postfix -- left
3* prefix ++  prefix --  sizeof  ~  !
unary +  unary -  unary &  unary *
right
4* casts right
5 * / % left
6 binary +  binary - left
7 << >>  left
8 < > <= >= left
9 == != left
10 binary & left
11 binary ^ left
12 binary | left
13+ && left
14+ || left
15 ? : right
16 =  +=  -=  *=  /=  %=
<<=  >>=  &=  ^=  |=
right
17 , left

程式設計課程 首頁
by Pei-yih Ting
E-mail: pyting@cs.ntou.edu.tw