c language operator precedence

Release: 2020-03-03 14:36:08
Original
33029 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:

##3Type conversion operator: (type name) From right to left##456##7Relational operator:< <= >>=From left to right8Equality operator: == !=Left to right9Bitwise operator AND: &Left to right10Bitwise operator XOR: ^From left to right11Bitwise operator OR: | Left to rightLogical operator AND: &&Logical operator OR: || Conditional operator: ?:Assignment operator: =   =     -=     *=   /= %=      &=                                                                                                                            <<= >>=
PriorityOperatorAssociative Law
1Suffix Operator: [] () · -> --(type name){list}from left to right
2 Unary operators: -- ! ~ - - * & sizeof_Alignofright 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 right13
From left to right14
Right to left15
From right to left
16Comma operator:, From left to right

#For more programming-related content, please pay attention to the Programming Introduction column 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 [email protected]
Popular Tutorials
More>
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!