Note: The label 1-15 priority is from high to low.
Priority level |
Operator |
Meaning |
Number of operations |
Combination direction |
1
|
() [].
|
Parentheses subscript operator Pointer to struct member operator struct member operator |
|
From left to right |
2
|
! ~ ++ -- - (type) * & sizeof |
Logical Non- Bitwise REVERSE Self-increment Self-reduction Minus sign Type conversions Pointer operators Take address character Length operator |
1 (single-mesh operator)
|
From right to left |
3 |
* / % |
Multiplication, division, redundancy |
2 (binocular operator) |
From left to right |
4 |
+ - |
addition, subtraction |
2 (binocular operator) |
From left to right |
5 |
<< >> |
Move left, move right |
2 (binocular operator) |
From left to right |
6 |
< <= > >= |
Relational operators |
2 (binocular operator) |
From left to right |
7 |
= =! = |
equals Not equal to operator |
2 (binocular operator) |
From left to right |
8 |
& |
Bitwise-AND |
2 (binocular operator) |
From left to right |
9 |
^ |
Bitwise XOR OR |
2 (binocular operator) |
From left to right |
10 |
| |
Bitwise OR |
2 (binocular operator) |
From left to right |
11 |
&& |
Logic and operations |
2 (binocular operator) |
From left to right |
12 |
|| |
Logical OR operation |
2 (binocular operator) |
From left to right |
|
|
3 (trinocular operator) |
from right to left |
|
= + = = *=/= %= >>= <<= &= ^= |= |
assignment operator |
2 |
|
15 |
, |
Comma operator |
|
From left to right |
Memory Method:
Elementary operator: () The bitwise operator--operator--operator------------ ), the assignment operator, the conditional operator, and the comma operator
C-language Operator precedence summary