Practical C Programming, 3rd Edition (2011)
Part IV. Other Language Features
Appendix C. Operator Precedence Rules
Standard Rules
Operators listed in Table C-1 near the top are evaluated before those below.
Table C-1. C Precedence Rules
|
Precedence |
Operator |
||||
|
1. |
( ) |
[ ] |
-> |
. |
|
|
2. |
! |
~ |
++ |
— |
(type) |
|
- (unary) |
* (dereference) |
||||
|
& (address of) |
sizeof |
||||
|
3. |
* (multiply) |
/ |
% |
||
|
4. |
+ |
- |
|||
|
5. |
<< |
>> |
|||
|
6. |
< |
<= |
> |
>= |
|
|
7. |
== |
!= |
|||
|
8. |
& (bitwise and) |
||||
|
9. |
^ |
||||
|
10. |
| |
||||
|
11. |
&& |
||||
|
12. |
|| |
||||
|
13. |
?: |
||||
|
14. |
= |
+= |
-= |
etc. |
|
|
15. |
, |
||||
Practical Subset
Table C-2. Precedence Rules, Practical Subset
|
Precedence |
Operator |
||
|
1. |
* (multiply) |
/ |
% |
|
2. |
+ |
- |
|
Put parentheses around everything else.
All materials on the site are licensed Creative Commons Attribution-Sharealike 3.0 Unported CC BY-SA 3.0 & GNU Free Documentation License (GFDL)
If you are the copyright holder of any material contained on our site and intend to remove it, please contact our site administrator for approval.
© 2016-2026 All site design rights belong to S.Y.A.