Super detailed C operator precedence

C language operator priority

priority

Operator

Name or meaning

Use form

Binding direction

Description

1

[]

Array subscript

Array name [constant expression]

Left to right

--

()

Parentheses

(expression) / function name (form parameter table)

--

.

Member selection (object)

Object. member name

--

->

Member selection (pointer)

Object pointer -> member name

--

2

-

Negative operator

-expression

Right to left

Monocular operator

~

Bitwise negation operator

~expression

++

Auto increment operator

++ variable name / variable name ++

--

Self-decreasing operator

-- variable name / variable name --

*

Value operator

* pointer variable

&

Address operator

&variable name

!

Logical non-operator

!expression

( type )

Forced type conversion

(data type) expression

--

Sizeof

Length operator

Sizeof (expression)

--

3

/

except

Expression/expression

Left to right

Binocular operator

*

Multiply

Expression * expression

%

Remainder (modulo)

Integer expression % integer expression

4

+

plus

Expression + expression

Left to right

Binocular operator

-

Less

Expression-expression

5

<<

Shift left

Variable << expression

Left to right

Binocular operator

>>

Shift right

Variable>>expression

6

>

more than the

Expression>expression

Left to right

Binocular operator

>=

greater or equal to

Expression>=expression

<

Less than

Expression <expression

<=

Less than or equal to

Expression <= expression

7

==

equal

Expression == expression

Left to right

Binocular operator

! =

not equal to

Expression != expression

8

&

Bitwise and

Expression & expression

Left to right

Binocular operator

9

^

Bitwise XOR

Expression ^ expression

Left to right

Binocular operator

10

|

Bitwise or

Expression|expression

Left to right

Binocular operator

11

&&

Logic and

Expression && expression

Left to right

Binocular operator

12

||

Logical or

Expression||expression

Left to right

Binocular operator

13

?:

Conditional operator

Expression 1?

Expression 2: Expression 3

Right to left

Trinocular operator

14

=

Assignment operator

Variable=expression

Right to left

--

/=

After assignment

Variable /= expression

--

*=

Multiply assignment

Variable *= expression

--

%=

Assignment after modulo

Variable %=expression

--

+=

Add value

Variable += expression

--

-=

Subtracted assignment

Variable -= expression

--

<<=

Assign after shifting left

Variable <<< expression

--

>>=

Assign after right shift

Variable >>= expression

--

&=

Bitwise and post assignment

Variable &= expression

--

^=

Bitwise XOR assignment

Variable ^= expression

--

|=

Bitwise or post assignment

Variable |= expression

--

15

,

Comma operator

Expression, expression,...

Left to right

--

Description:

Operators of the same priority, the order of operations is determined by the direction of the join.

The simple note is: ! > Arithmetic Operators > Relational Operators > && > || > Assignment Operator

Vent Spacer

Vent spacer,stator core vent spacer lamination,stator core vent spacer,vent plates

Henan Yongrong Power Technology Co., Ltd , https://www.hnyongrongglobal.com