c language operator precedence

Release: 2020-03-03 14:36:08
Original
33111 people have browsed it

c language operator precedence

An expression can contain multiple operators. In this case, the precedence of the operators determines which part of the expression is processed as the operand of each operator.

Recommended: "c Language Tutorial"

If two operands in an expression have the same priority, then their associativity determines They are combined from left to right or right to left.

The precedence and associativity of all C language operators:

##3 Type conversion operator: (type name) From right to left ##4 5 6 ##7 Relational operator:< <= >>= From left to right 8 Equality operator: == != Left to right 9 Bitwise operator AND: & Left to right 10 Bitwise operator XOR: ^ From left to right 11 Bitwise operator OR: | Left to right Logical operator AND: && Logical operator OR: || Conditional operator: ?: Assignment operator: = = -= *= /= %= &= <<= >>=
Priority Operator Associative Law
1 Suffix Operator: [] () · -> --(type name){list} from left to right
2 Unary operators: -- ! ~ - - * & sizeof_Alignof right to left
Multiplication and division operators: * / % From left to right
Addition and subtraction operators: - From left to right
Shift operator:<< >> From left to right
##12
Left to right 13
From left to right 14
Right to left 15
From right to left
16 Comma operator:, From left to right

#For more programming-related content, please pay attention to theProgramming Introductioncolumn on the php Chinese website!

The above is the detailed content of c language operator precedence. 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 Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!