C++ - Operator Precedence
2024-10-19 06:24:40
The following table lists the precedence and associativity of C++ operators. Operators are listed top to bottom, in descending precedence.
Precedence | Operator | Description | Associativity |
---|---|---|---|
1 | :: |
Scope resolution | Left-to-right |
2 | ++ -- |
Suffix/postfix increment and decrement | |
type() type{} |
Function-style type cast | ||
() |
Function call | ||
[] |
Array subscripting | ||
. |
Element selection by reference | ||
-> |
Element selection through pointer | ||
3 | ++ -- |
Prefix increment and decrement | Right-to-left |
+ - |
Unary plus and minus | ||
! ~ |
Logical NOT and bitwise NOT | ||
(type) |
C-style type cast | ||
* |
Indirection (dereference) | ||
& |
Address-of | ||
sizeof |
Size-of | ||
new ,new[] |
Dynamic memory allocation | ||
delete ,delete[] |
Dynamic memory deallocation | ||
4 | .* ->* |
Pointer to member | Left-to-right |
5 | * / % |
Multiplication, division, and remainder | |
6 | + - |
Addition and subtraction | |
7 | << >> |
Bitwise left shift and right shift | |
8 | < <= |
For relational operators < and ≤ respectively | |
> >= |
For relational operators > and ≥ respectively | ||
9 | == != |
For relational = and ≠ respectively | |
10 | & |
Bitwise AND | |
11 | ^ |
Bitwise XOR (exclusive or) | |
12 | | |
Bitwise OR (inclusive or) | |
13 | && |
Logical AND | |
14 | || |
Logical OR | |
15 | ?: |
Ternary conditional | Right-to-left |
= |
Direct assignment (provided by default for C++ classes) | ||
+= -= |
Assignment by sum and difference | ||
*= /= %= |
Assignment by product, quotient, and remainder | ||
<<= >>= |
Assignment by bitwise left shift and right shift | ||
&= ^= |= |
Assignment by bitwise AND, XOR, and OR | ||
16 | throw |
Throw operator (for exceptions) | |
17 | , |
Comma | Left-to-right |
最新文章
- linux不同角色server分区方案
- win10 office2013激活工具
- 纯CSS3实现3D动画导航,html5 webRTC技术实现免费网页电话拨打
- C++类的继承实例
- 好的 小图标 html
- Linux工具之bc计算器进制的转换
- gulp提高微信小程序开发效率
- Java实现Http请求的常用方式
- MSMQ 和 MQTT
- SpringCloud笔记四:Ribbon
- eclipse-jee-kepler 如何设置编译compiler为1.8
- SQL中的ALL,ANY,SOME的用法
- PHP 进行支付宝开发中return_url和notify_url的区别分析
- OSPF路由协议(一)
- [leetcode]Insert Interval @ Python
- 【转载】Android 关于arm64-v8a、armeabi-v7a、armeabi、x86下的so文件兼容问题
- RequireJS模块化之循环依赖
- static, const 和 static const 变量的初始化问题
- Markdown入门简介
- win7装postgresql10.4
热门文章
- JavaScript 、ECMAScript、commonJS 发展历史 与标准化发展
- centos 推荐使用epel源
- 关于 Oracle外键列上是否需要索引问题?
- NanShan即时通讯论——HTML5的优势与劣势
- sencha touch笔记(5)——DataView组件(1)
- 闲扯 Javascript 02 全选、不选、反选
- 关于Linux系统清理/tmp/文件夹的原理
- 《高质量程序设计指南:C++/C语言》面试题整理
- 130825组队赛-Regionals 2012, North America - East Central NA
- Eclipse一个打开文件夹目录插件——Open In Explorer