The operator priority is shown in the following table, which is reduced from left to right and from top to bottom.
() (Parentheses) [] (array subscript). (structure member)-> (pointer structure member) maximum limit
── ─ ┃ ↑
! (Non-logical). (bitwise inverse)-(negative) ++ (plus 1) -- (minus 1) & (variable address) │
── ─ ┃ │
* (Pointer content) type (function description) sizeof (length calculation) │
── ─ ┃ │
* (Multiplication)/(Division) % (Modulo) │
── ─ ┃ │
+ (Plus)-(minus) ┃ │
── ─ ┃ │
<(Shifted left)> (shifted right) │
── ─ ┃ │
<(Less than) <= (less than or equal to)> (greater than)> = (greater than or equal to) │
── ─ ┃ │
= (Equal )! = (Not equal to) sampled │
── ─ ┃ │
& (Bits and) bytes │
── ─ ┃ │
^ (Bitwise OR) │
── ─ ┃ │
| (Bit or) │
── ─ ┃ │
& (Logical and) │
── ─ ┃ │
| (Logical or) │
── ─ ┃ │
? :(? Expression) │
── ─ ┃ │
= + =-= (Joint Operation) │
── ─ ┃ │
, (Comma operator) the lowest limit
//////////////////////////////////////// //////////////////////////////////////// //////////////////////////////////////
Priority operator meaning operator type combination direction
15 () parentheses () from left to right)
[] Subscript operator
-> Pointer to struct member operators
, Struct member operators
14! Logical non-operator from right to left
~ Bitwise Inverse Operator
++ Auto-increment operator
-- Auto-subtraction Operator
-Minus sign Operator
(Type) type conversion Operator
* Pointer Operators
& Address Operators
Sizeof length Operator
13 * multiplication OPERATOR: left-to-right
/Division Operator
% Remainder Operator
12 + addition Operators
-Subtraction Operator
11 <left shift operator
> Right shift operator
10 <, <=,>,> = Relational operators
9 = equals Operator
! = Not equal to operator
8 & bitwise AND operator
7 ^ bitwise XOR or operator
6 | bitwise OR operator
5 & logic and operators
4 | logical or operator
3? : The conditional operators are displayed from the right to the left.
2 =, + =,-=, * =,
/=, % =, >>=,
<<=, & =, ^ =, | = Binary value assignment operator
1. the comma operator is left-to-right.