Home > Common Problem > body text

What is the priority order in C language?

zbt
Release: 2023-09-07 16:08:09
Original
30546 people have browsed it

C language priority order: 1. Various brackets; 2. All unary operators; 3. Multiplication operator *, division operator /, remainder operator %; 4. Addition operator , Subtraction operator -; 5. Shift operator <<, >>; 6. Greater than operator>, Greater than or equal to operator>=, Less than operator<, Less than or equal to operator< =; 7. Equal operator ==, not equal operator !=; 8. Bitwise AND operator &; 9. Bitwise XOR operator ^; 10. Bitwise OR operator |; 11. Logical AND operation Symbols && and so on.

What is the priority order in C language?

The operating system for this tutorial: Windows 10 system, C 20 version, DELL G3 computer.

The operators in C language include unary operators, binary operators, and ternary operators. The priorities are as follows:

First priority: various brackets, such as (), [], etc., member operators. ;

2nd priority: all unary operators, such as, –, !, ~, etc.;

3rd priority: multiplication operator* , division operator/, remainder operator%;

4th priority: addition operator, subtraction operator-;

5th priority: shift operator<< ;,>>;

6th priority: greater than operator>, greater than or equal to operator>=, less than operator<, less than or equal to operator<=;

7th priority: equal operator==, not equal to operator!=;

8th priority: bitwise AND operator&;

9th priority: press Bitwise XOR operator^;

10th priority: Bitwise OR operator|;

11th priority: Logical AND operator&&;

12th Priority: logical OR operator||;

13th priority: ternary conditional operator?: ;

14th priority: various assignment operators, such as =, = , -=, *=, /=, etc.;

15th priority: comma operation, .

The above is the detailed content of What is the priority order in C language?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template