优先级关系,从高到底:
(高优先级)
关联操作符:() [] -> .
一元操作符:! - ++ -- + - (type) * & sizeof
乘法操作符:* / %
加法操作符:+ -
移位操作符:<< >>
关系操作符:< <= > >=
“相等”比较:== !=
位操作符:&
位操作符:^
位操作符:|
逻辑操作符:&&
逻辑操作符:||
条件操作符:?:
赋值操作符:= += -= 等等
逗号:,
(低优先级)
运算方向:
() [] -> . left to right
! ~ ++ -- + - * (type) sizeof right to left
* / % left to right
+ - left to right
<< >> left to right
< <= > >= left to right
== != left to right
& left to right
^ left to right
| left to right
&& left to right
|| left to right
?: right to left
= += -= *= /= %= &= ^= |= <<= >>= right to left
, left to right
阅读(332) | 评论(0) | 转发(0) |