http://www.cppreference.com/operator_precedence.html
Precedence |
Operator |
Description |
Example |
Associativity |
1 |
() |
Grouping operator |
(a + b) / 4; |
left to right |
2 |
! |
Logical negation |
if( !done ) ... |
right to left |
3 |
->* |
Member pointer selector |
ptr->*var = 24; |
left to right |
4 |
* |
Multiplication |
int i = 2 * 4; |
left to right |
5 |
+ |
Addition |
int i = 2 + 3; |
left to right |
6 |
<< |
Bitwise shift left |
int flags = 33 << 1; |
left to right |
7 |
< |
Comparison less-than |
if( i < 42 ) ... |
left to right |
8 |
== |
Comparison equal-to |
if( i == 42 ) ... |
left to right |
9 |
& |
Bitwise AND |
flags = flags & 42; |
left to right |
10 |
^ |
Bitwise exclusive OR |
flags = flags ^ 42; |
left to right |
11 |
| |
Bitwise inclusive (normal) OR |
flags = flags | 42; |
left to right |
12 |
&& |
Logical AND |
if( conditionA && conditionB ) ... |
left to right |
13 |
|| |
Logical OR |
if( conditionA || conditionB ) ... |
left to right |
14 |
? : |
Ternary conditional (if-then-else) |
int i = (a > b) ? a : b; |
right to left |
15 |
= |
Assignment operator |
int a = b; |
right to left |
16 |
, |
Sequential evaluation operator |
for( i = 0, j = 0; i < 10; i++, j++ ) ... |
left to right |
原文链接: https://www.cnblogs.com/wuzhenbo/archive/2012/04/26/2470848.html
欢迎关注
微信关注下方公众号,第一时间获取干货硬货;公众号内回复【pdf】免费获取数百本计算机经典书籍
原创文章受到原创版权保护。转载请注明出处:https://www.ccppcoding.com/archives/48537
非原创文章文中已经注明原地址,如有侵权,联系删除
关注公众号【高性能架构探索】,第一时间获取最新文章
转载文章受原作者版权保护。转载请注明原作者出处!