C Programming: Operator Precedence and Associatively
Operator | Description | Associatively | Rank |
() [] | Function Call Array element reference | Left to Right | 1 |
+ – ++ — ! ~ * & sizeof (type) | Unary Plus Unary Minus Increment Decrement Logical Negation Ones Complement Pointer Reference Address Size of Object Type Cast | Right to Left | 2 |
* / % | Multiplication Division Modulus | Left to Right | 3 |
+ – | Addition Subtraction | Left to Right | 4 |
<< >> | Left Shift Right Shift | Left to Right | 5 |
< <= > >= | Less Than Less Than or Equal to Grater than Greater than or equal to | Left to Right | 6 |
== != | Equality Inequality | Left to Right | 7 |
& | Bitwise AND | Left to Right | 8 |
^ | Bitwise XOR | Left to Right | 9 |
| | Bitwise OR | Left to Right | 10 |
&& | Logical AND | Left to Right | 11 |
|| | Logical OR | Left to Right | 12 |
?: | Conditional expression | Right to Left | 13 |
= *=/=%= +=-=&= ^=|= <<=>>= | Assignment Operators | Right to Left | 14 |
, | Comma operator | Left to Right | 15 |