C Operators
Operator | Operands |
Description |
Precedence | Associativity |
() | 2 | Function call |
15 | Left to Right |
[] | 2 | Selection of Array element |
15 | Left to Right |
. | 2 | Selection of member of structure or union |
15 | Left to Right |
-> | 2 | Selection of member of pointed to structure or union |
15 | Left to Right |
! | 1 | Logical NOT |
14 | Right to Left |
- | 1 | Sign change |
14 | Right to Left |
++ | 1 | Increment |
14 | Right to Left |
-- | 1 | Decrement |
14 | Right to Left |
& | 1 | Reference |
14 | Right to Left |
* | 1 | Dereference |
14 | Right to Left |
(type) | 1 | Type cast |
14 | Right to Left |
* | 2 | Multiplication |
13 | Left to Right |
/ | 2 | Division |
13 | Left to Right |
% | 2 | Remainder |
13 | Left to Right |
+ | 2 | Addition |
12 | Left to Right |
- | 2 | Subtraction |
12 | Left to Right |
~ | 2 | Bitwise NOT |
12 | Left to Right |
<< | 2 | Left shift |
11 | Left to Right |
>> | 2 | Right shift |
11 | Left to Right |
< | 2 | Less than |
10 | Left to Right |
> | 2 | Greater than |
10 | Left to Right |
<= | 2 | Less than or equal to |
10 | Left to Right |
>= | 2 | Greater than or equal to |
10 | Left to Right |
== | 2 | Equal to |
9 | Left to Right |
!= | 2 | Not equal to |
9 | Left to Right |
& | 2 | Bitwise AND |
8 | Left to Right |
^ | 2 | Bitwise exculsive OR |
7 | Left to Right |
| | 2 | Bitwise OR |
6 | Left to Right |
&& | 2 | Logical AND |
5 | Left to Right |
|| | 2 | Logical OR |
4 | Left to Right |
?: | 3 | Conditional evaluation |
3 | Right to Left |
= | 2 | Assignment |
2 | Right to Left |
*= | 2 | Multiplication assignment |
2 | Right to Left |
/= | 2 | Division assignment |
2 | Right to Left |
%= | 2 | Remainder assignment |
2 | Right to Left |
+= | 2 | Addition assignment |
2 | Right to Left |
-= | 2 | Subtraction assignment |
2 | Right to Left |
<<= | 2 | Left Shift assignment |
2 | Right to Left |
>>= | 2 | Multiplication assignment |
2 | Right to Left |
&= | 2 | Bitwise AND assignment |
2 | Right to Left |
^= | 2 | Bitwise exclusive OR assignment |
2 | Right to Left |
|=
| 2 | Bitwise OR assignment |
2 | Right to Left |
, | 2 | Sequence |
1 | Left to Right |