Table of associativity & precedence of operator
Operator | Description | Associativity | Precedence |
---|---|---|---|
() | Function calling operator | Left to right | 14 |
[] | Array index | ||
. | Dot membership operator | ||
-> | Selection of Element using pointer | ||
! | NOT Operator | Right to left | 13 |
~ | One’s-complement | ||
— | Unary minus | ||
++ | Increment | ||
— — | Decrement | ||
& | Address of operator | ||
* | Indirection | ||
(type) | Data type casting | ||
Sizeof | Sizeof | ||
* | Multiplication | Left to right | 12 |
/ | Division | ||
% | Modulus operator (reminder) | ||
+ | Addition operator | Left to right | 11 |
— | Subtraction operator | ||
<< | Left shift operator | Left to right | 10 |
>> | Right shift operator | ||
< | Less than operator | Left to right | 9 |
<= | Less than or equal operator | ||
> | Greater than operator | ||
>= | Greater than or equal operator | ||
== | Equal operator | ||
!= | Not equal operator | ||
& | Bitwise AND operator | Left to right | 8 |
^ | Bitwise XOR operator | Left to right | 7 |
| | Bitwise OR operator | Left to right | 6 |
&& | Logical AND operator | Left to right | 5 |
|| | Logical OR operator | Left to right | 4 |
?: | Conditional operator | Right to left | 3 |
=, + =* =, etc. | Assignment operators | Left to right | 2 |
, | Comma | Left to right | 1 |
Next Previous