C language operator priority

Source: Internet
Author: User

C language operator priority

 

Priority

Operator

Meaning

Operation required

Number of Objects

Integration direction

1

()

[]

->

.

Parentheses

Subscript operator

Point to struct member operators

Struct member operators

 

From left to right

2

!

Logical non-Operator

1

(Single object operator)

From right to left

~

Bitwise Inverse Operator

++

Auto-increment operator

--

Auto-subtraction Operator

-

Negative Operator

(Type)

Type conversion Operator

*

Pointer Operator

&

Addresses and operators

Sizeof

Length Operator

3

*

/

%

Multiplication Operator

Division Operator

Remainder Operator

2

(Binary operator)

From left to right

4

+

-

Addition Operator

Subtraction Operator

2

(Binary operator)

From left to right

5

<

>

Left Shift Operator

Right Shift Operator

2

(Binary operator)

 

6

<

<=

>

> =

Relational operators

2

(Binary operator)

From left to right

7

=

! =

Equal to operator

Not equal to operator

2

(Binary operator)

From left to right

8

&

Bitwise AND operator

2

(Binary operator)

From left to right

9

^

Bitwise OR operator

2

(Binary operator)

From left to right

10

|

Bitwise OR operator

2

(Binary operator)

From left to right

11

&&

Logic and operators

2

(Binary operator)

From left to right

12

|

Logic or operator

2

(Binary operator)

From left to right

13

? :

Conditional Operators

3

(Three-object Operation)

From right to left

14

=

+ =

-=

* =

/=

% =

>>=

<=

& =

^ =

| =

Value assignment operator

2

From right to left

15

,

Comma Operator

 

From left to right

 

Operator priority memory method:

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.