運算元優先順序及結合律

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

程式設計課程 首頁

製作日期: 09/13/2008 by 丁培毅 (Pei-yih Ting)
E-mail: pyting@mail.ntou.edu.tw TEL: 02 24622192x6615
海洋大學 電機資訊學院 資訊工程學系 Lagoon