Operator precedence rules in C
Operator precedence rules
|
Operators |
Order of evaluation |
Remarks |
|---|---|---|
|
[] ( ) -> |
Left to right |
Array subscript, function call |
|
− + sizeof( ) ! ++ −− |
|
|
|
& * ~ (cast) |
Right to left |
Unary |
|
* / % |
Left to right |
Binary Multiplicative |
|
+ - |
Left to right |
Binary Additive |
|
>> << |
Left to right |
Shift operators |
|
< <= > >= |
Left to right |
Relational operators |
|
== != |
Left to right |
Equality operators |
|
& |
Left to right |
Bitwise AND operator |
|
^ |
Left to right |
Bitwise XOR operator |
|
| |
Left to right |
Bitwise OR operator |
|
&& |
Left to right |
Logical And operator |
|
|| |
Left to right |
Logical Or operator |
|
?: |
Left to right |
Conditional operator |
|
= += -= *= /= %= |
|
|
|
&= -= |= <<= >>= |
Right to left |
Assignment |
|
, |
Right to left |
Comma |
posted on 2014-01-03 20:30 Shawn X.Y. Bai 阅读(250) 评论(0) 收藏 举报
浙公网安备 33010602011771号