[转]C++运算优先级列表
From:http://en.cppreference.com/w/cpp/language/operator_precedence
| Precedence | Operator | Description | Associativity |
|---|---|---|---|
| 1 | :: |
Scope resolution | Left-to-right |
| 2 | ++ -- |
Suffix/postfix increment and decrement | |
() |
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) |
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 |
[转]C++运算优先级列表的更多相关文章
- PHP数据运算优先级总结记忆
运算符优先级
- java数据类型和运算优先级
一.数据类型 1.基本数据类型: . 布尔类型:boolean(true,false) . 整型:byte(-128,127).short(-32768,32767).int(-2147483648, ...
- [c/c++] programming之路(9)、运算优先级
一.运算优先级 二.条件运算符(表达式1?表达式2:表达式3) 当式1正确时,取式2的值:否则,取式3的值 三.格式字符 #include<stdio.h> #include<std ...
- C 运算优先级口诀
运算优先级口诀: 括号成员第一; //括号运算符[]() 成员运算符. -> 全体单目第二; //所有的单目运算符比如!.~.++. --. +(正). -(负) ...
- Python之路迭代器协议、for循环机制、三元运算、列表解析式、生成器
Python之路迭代器协议.for循环机制.三元运算.列表解析式.生成器 一.迭代器协议 a迭代的含义 迭代器即迭代的工具,那什么是迭代呢? #迭代是一个重复的过程,每次重复即一次迭代,并且每次迭代的 ...
- c语言运算优先级与结合方向的问题
c语言运算的结合方向一直困扰我,不过我终于get到了哈哈 先附上c语言运算优先级和结合方向图片 以上有c语言一共的15个优先级,从上往下递增 c语言的运算符号有很多,当我们打代码或者看代码的时候符号多 ...
- python函数,lambda表达式,三目运算,列表解析,递归
一.自定义函数 定义函数时,函数体不执行:只有在调用函数时,函数体才执行.函数的结构: 1. def 2. 函数名 3. 函数体 def func_name(): 函数体 4. 返回值 如果没有声明返 ...
- JavaScript 中运算优先级问题
优先级引发的问题 这篇文章对 JavaScript 中的运算符进行小结,很多人对运算符优先级这一知识点都是一带而过.这就导致在写一些比较奇葩的 js 代码,你并不知道它的输出是啥,下面举一个例子,这也 ...
- python各种运算优先级一览表
##python各种运算的优先级 运算符 描述 lambda Lambda表达式 or 布尔"或" and 布尔"与" not x 布尔"非" ...
随机推荐
- proxool在web环境中的使用
proxool在web环境中的使用 简介 Proxool连接池是sourceforge下的一个开源项目,这个项目提供一个健壮.易用的连接池,最为关键的是这个连接池提供监控的功能,方便易用,便于发现连接 ...
- HBase启动和停止命令
启动HBase集群: bin/start-hbase.sh 单独启动一个HMaster进程: bin/hbase-daemon.sh start master 单独停止一个HMaster进程: bin ...
- iphone SE 自带视频播放器要求的视频格式转换参数
- commonJS — 数组操作(for Array)
for Array github: https://github.com/laixiangran/commonJS/blob/master/src/forArray.js 代码 /** * Creat ...
- linux 重命名文件和文件夹
linux下重命名文件或文件夹的命令mv既可以重命名,又可以移动文件或文件夹. 例子:将目录A重命名为B mv A B 例子:将/a目录移动到/b下,并重命名为c mv /a /b/c 其实在文本模式 ...
- java 集合(Map2)
Map 接口的迭代方法: import java.util.*; public class ex12 { public static void main(String[] args) { Map< ...
- 例题:输入您的出生日期,判断你的星座,主要练习使用datetime类及if else语句。很实用
while (true) { Console.WriteLine("请输入您的生日(年-月-日)");//提示输入 string x = Console.ReadLine();// ...
- java的System.getProperty()方法可以获取的值
java.version Java 运行时环境版本 java.vendor Java 运行时环境供应商 java.vendor.url Java 供应商的 URL java.home Java 安装目 ...
- Jquery 操作Html 控件 CheckBox、Radio、Select 控件 【转】http://www.cnblogs.com/lxblog/archive/2013/01/09/2853056.html
Jquery 操作Html 控件 CheckBox.Radio.Select 控件 在使用 Javascript 编写前台脚本的时候,经常会操作 Html 控件,比如 checkbox.radio ...
- android 模拟器 使用键盘的配置
1 打开 android Manageer , 克隆一个设备 2.