Operator Precedence Cheat Sheet

operator precedence

Priority [high to low]:

Level 1:

Parentheses [()], subscript operator [[]], component operator pointing to structure member operator [->], structure member operator [.]

second level:

Logical NOT operator [!], bitwise negation operator [~], increment and decrement operator [++ –], minus operator [-], type conversion operator [(type)], pointer operation operator and address operator [* and &], length operator [sizeof]

Level 3:

Multiplication operator [*], division operator [/], remainder operator [%]

Fourth level:

Addition operator [+], Subtraction operator [-]

Level 5:

Left shift operator [<<], right shift operator [>>]

Level 6:

Relational operators [< > <= >= ]

Level 7:

Equal operator [==], not equal operator [!=]

Eighth level:

Bitwise AND operator [&]

Level 9:

Bitwise XOR operator [^]

Level 10:

Bitwise OR operator [|]

Level 11:

Logical AND operator [&&]

Twelfth level:

Logical OR operator [||]

Thirteenth level:

Conditional operator [?:]

Fourteenth grade:

Assignment operator [= += -= *= /= %= >>= <<.= &= |= ^=]

Level 15:

comma operator [,]

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325594384&siteId=291194637