VC++常用功能开发汇总(专栏文章列表,欢迎订阅,持续更新...)https://blog.csdn.net/chenlycly/article/details/124272585C++软件异常排查从入门到精通系列教程(专栏文章列表,欢迎订阅,持续更新...)
https://blog.csdn.net/chenlycly/article/details/125529931C++软件分析工具从入门到精通案例集锦(专栏文章正在更新中...)
https://blog.csdn.net/chenlycly/article/details/131405795C/C++基础与进阶(专栏文章,持续更新中...)
https://blog.csdn.net/chenlycly/category_11931267.html 当一个复杂的表达式中包含了多个运算符时,要读懂表达式的含义,就需要搞清楚这些运算符的优先级。下面完整地罗列了所有C++运算符的优先级,以供查阅和参考。
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 |