Priority level |
Operator |
Name or meaning |
Use form |
Combining direction |
Description |
1 |
[] |
Array subscript |
array name [constant expression] |
Left to right |
|
() |
Parentheses |
(expression)/function name (formal parameter list) |
|
. |
Member selection (object) |
Object. Member name |
|
-> |
Member selection (pointers) |
Object pointer-> member name |
|
2 |
- |
Minus sign operator |
-An expression |
Right to Left |
Monocular operator |
Type |
Force type conversions |
(data type) expression |
|
++ |
Self-increasing operator |
+ + variable name/variable name + + |
Monocular operator |
-- |
Self-subtraction operators |
--Variable name/variable name-- |
Monocular operator |
* |
Value operator |
* Pointer variable |
Monocular operator |
& |
Take address operator |
& Variable Name |
Monocular operator |
! |
Logical non-operator |
! An expression |
Monocular operator |
~ |
Bitwise inverse operator |
~ Expression |
Monocular operator |
sizeof |
Length operator |
sizeof (expression) |
|
3 |
/ |
Except |
An expression/expression |
Left to right |
Binocular operator |
* |
By |
Expression * Expression |
Binocular operator |
% |
Remainder (modulo) |
Integral expression/integer expression |
Binocular operator |
4 |
+ |
Add |
expression + expression |
Left to right |
Binocular operator |
- |
Reducing |
Expression-An expression |
Binocular operator |
5 |
<< |
Move left |
Variables << expressions |
Left to right |
Binocular operator |
>> |
Move right |
Variables >> expressions |
Binocular operator |
6 |
> |
Greater than |
Expressions > expressions |
Left to right |
Binocular operator |
>= |
Greater than or equal to |
Expression >= An expression |
Binocular operator |
< |
Less than |
Expressions < expressions |
Binocular operator |
<= |
Less than or equal to |
Expression <= An expression |
Binocular operator |
7 |
== |
Equals |
expression = = Expression |
Left to right |
Binocular operator |
!= |
Not equal to |
Expression!= An expression |
Binocular operator |
8 |
& |
Bitwise AND |
Expressions & Expressions |
Left to right |
Binocular operator |
9 |
^ |
Per-bitwise XOR OR |
expression ^ expression |
Left to right |
Binocular operator |
10 |
| |
by bit or |
Expressions-Expressions |
Left to right |
Binocular operator |
11 |
&& |
Logic and |
Expressions && Expressions |
Left to right |
Binocular operator |
12 |
|| |
Logical OR |
expression | | An expression |
Left to right |
Binocular operator |
13 |
?: |
Conditional operator |
Expression of 1? Expression 2: Expression 3 |
Right to Left |
Three-mesh operator |
14 |
= |
Assignment operator |
variable = expression |
Right to Left |
|
/= |
Assign value in addition to |
Variable/= expression |
|
*= |
After multiplication assign value |
Variable *= expression |
|
%= |
To assign a value after taking a model |
Variable%= expression |
|
+= |
Add and then assign value |
Variable = = Expression |
|
-= |
After minus assignment |
Variable-= expression |
|
<<= |
Assign values after left shift |
Variable <<= expression |
|
>>= |
Assign value after right shift |
Variable >>= expression |
|
&= |
Bitwise AND Post-assignment |
Variable &= expression |
|
^= |
Assign values by bitwise OR after |
Variable ^= expression |
|
|= |
Bitwise OR post-value assignment |
Variable |= expression |
|
15 |
, |
Comma operator |
expressions, Expressions,... |
Left to right |
Order from left to right |
Description
operator of the same priority, the order of operations is determined by the binding direction.
The simple note is:. > Single-eye operator > Arithmetic operator > Relational operator > && > | | > Assignment Operators