[转]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 布尔"非" ...
随机推荐
- HM中再增加一路自己的entropy coder
compressSlice 中一开始的entropy coder 设置: // set entropy coder if( m_pcCfg->getUseSBACRD() ) { m_pcSba ...
- 【Python】输出中文字符串的两种方法
print u"中文" # -*- coding: utf-8 -*- 这句话放在最上面,记得是最上面,顶格写 这样,print后,字符串前就不用加u了
- VC++ 中使用 std::string 转换字符串编码
目录 第1章说明 1 1.1 代码 1 1.2 使用 4 第1章说明 VC++中宽窄字符串的相互转换比较麻烦,借助std::string能大大减少代码量. 1.1 代码 函数声明如下 ...
- VC++多工程项目
目录 第1章 VC++6.0 1 1.1 设置依赖关系 1 1.2 编译顺序 2 1.3 自动连接 3 1.4 静态库 3 1.4.1 嵌入 3 1.4.2 替换 ...
- java 集合(Map3)
Map接口下的实现类: HashMap 1.存储原理: 向HashMap中添加元素时,首先会调用hashCode(),算的哈希值,然后 算出该元素在哈希表中的存储位置. 情况1 情况2(java 集 ...
- jmeter笔记4
软件测试中使用JMeter测试Web应用 JMeter作用领域 JMeter可以用于测试静态或者动态资源的性能(文件.Servlets.Perl脚本.java对象.数据库和查询.ftp服务器或者其他 ...
- kmeans算法原理以及实践操作(多种k值确定以及如何选取初始点方法)
kmeans一般在数据分析前期使用,选取适当的k,将数据聚类后,然后研究不同聚类下数据的特点. 算法原理: (1) 随机选取k个中心点: (2) 在第j次迭代中,对于每个样本点,选取最近的中心点,归为 ...
- [redis] Redis 配置文件置参数详解
################################ 基础配置 ################################# #daemonize no 默认情况下, redis 不 ...
- Reverse Nodes in k-Group [LeetCode]
Problem Description: http://oj.leetcode.com/problems/reverse-nodes-in-k-group/ Basic Idea: Do it lik ...
- ztree edit_super
<SCRIPT type="text/javascript"> var setting = { view : { addHoverDom : addHoverDom, ...