Operator priority

xiaoxiao2021-03-06  21

There are dozens of operators in C / C language, and the priority of the operator is shown in Table 4-1. Note that the priority of one yuan operator - * is higher than the corresponding binary operator.

Priority operator combination law from high to low ranks () [] -> from left to right! ~ - (type) SIZEOF - * & from right to left * /% from left to right - from Left to right << >> From left to right <<=>> = from left to right & from left to right ^ from left to right | from left to right && from left to right | From right to left?: From right to left = = - = * = / =% = & = ^ = | = << = >> = from left to right

Table 4-1 Priority and Combination Law of Operators

l [rule

4-1-1] If the operators in the code line are more, use parentheses to determine the order of operation of the expression, avoid using the default priority.

转载请注明原文地址:https://www.9cbs.com/read-41147.html

New Post(0)