Priority level |
Operator |
Name or meaning |
Use form |
Combination 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 (pointer) |
Object pointers, member Names |
-- |
|
2 |
- |
Minus sign operator |
-expression |
Right to Left |
Monocular operator |
~ |
Bitwise inverse operator |
~ Expression |
++ |
Self-increment operator |
+ + variable name/variable name + + |
-- |
Self-decrement operator |
--variable name/variable name-- |
* |
Value operator |
* Pointer variable |
& |
Fetch address operator |
& Variable Name |
! |
Logical Non-operator |
! An expression |
Type |
Forcing type conversions |
(data Type) Expression |
-- |
sizeof |
Length operator |
sizeof (expression) |
-- |
|
3 |
/ |
Except |
An expression/expression |
Left to right |
Binocular operator |
* |
By |
Expression-expression * |
% |
Remainder (modulo) |
Integer expression% integer expression |
4 |
+ |
Add |
An expression + an expression |
Left to right |
Binocular operator |
- |
Reducing |
Expression-expression |
5 |
<< |
Move left |
Variables << expressions |
Left to right |
Binocular operator |
>> |
Move right |
Variables >> expressions |
|
6 |
> |
Greater than |
Expressions > expressions |
Left to right |
Binocular operator |
>= |
Greater than or equal |
expression->= expression |
< |
Less than |
Expressions < expressions |
<= |
Less than or equal |
expression-<= expression |
7 |
== |
Equals |
expression-= = Expression |
Left to right |
Binocular operator |
! = |
Not equal to |
expression! = Expression |
|
8 |
& |
Bitwise-and |
Expressions & Expressions |
Left to right |
Binocular operator |
9 |
^ |
Bitwise XOR OR |
An expression ^ expression |
Left to right |
Binocular operator |
10 |
| |
Bitwise OR |
Expression-expression |
Left to right |
Binocular operator |
11 |
&& |
Logic and |
Expressions && Expressions |
Left to right |
Binocular operator |
12 |
|| |
Logical OR |
An expression | | An expression |
Left to right |
Binocular operator |
|
13 |
?: |
Conditional operators |
Expression 1? Expression 2: Expression 3 |
Right to Left |
Trinocular operator |
|
14 |
= |
Assignment operators |
variable = expression |
Right to Left |
-- |
/= |
Assign value after addition |
variable-/= expression |
-- |
*= |
Multiply post-assign value |
variable-*= expression |
-- |
%= |
Assign value after modulo |
variable-%= expression |
-- |
+= |
Add after Assignment |
Variable + = expression |
-- |
-= |
Reduced-value Assignment |
variable-= expression |
-- |
<<= |
Assign value after left shift |
variable-<<= expression |
-- |
>>= |
Assign value after right shift |
variable->>= expression |
-- |
&= |
Bitwise AND post-assigned values |
variable-&= expression |
-- |
^= |
Bitwise XOR or Post-assignment |
variable-^= expression |
-- |
|= |
Bitwise OR post-assigned value |
variable-|= expression |
-- |
|
15 |
, |
Comma operator |
expression, expression,... |
Left to right |
-- |
Description
Operators of the same precedence, the order of operations is determined by the binding Direction.
Simple note is:! > Arithmetic operators > Relational operators > && > | | > Assignment Operators
Precedence of C + + operators (not in good order)