Precedence of Operators in C Language

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

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this:
?>