Precedence of Operators in C
All the operators in C language can be used together in an expression, C uses a certain hierarchy to solve such kind of mixed expressions, in the below table you will learn precedence of operators in C language.
The hierarchy and associatively of the operators discussed so far is summarized in the table.
Precedence Table of Operators in C Language
* The operators written in the same line have the same priority. The higher precedence operators are written first.
Operators | Associativity |
( ) [ ] -> . | left to right |
! ~ ++ — + – * & (type) sizeof | right to left |
* / % | left to right |
+ – | left to right |
<< >> | left to right |
< <= > >= | left to right |
!ERROR! illegal character ‘!’ | left to right |
& | left to right |
^ | left to right |
| | left to right |
&& | left to right |
|| | left to right |
?: | left to right |
!ERROR! illegal character ‘%’ | right to left |
, | left to right |