运算符优先级
来源:互联网 发布:轩辕剑之天之痕mac版 编辑:程序博客网 时间:2024/05/16 12:57
expr++ expr--
unary++expr --expr +expr -expr ~ !
multiplicative* / %
additive+ -
shift<< >> >>>
relational< > <= >= instanceof
equality== !=
bitwise AND&
bitwise exclusive OR^
bitwise inclusive OR|
logical AND&&
logical OR||
ternary? :
assignment= += -= *= /= %= &= ^= |= <<= >>= >>>=
::
Scope resolutionLeft-to-right++
--
Suffix/postfix increment and decrement()
Function call[]
Array subscripting.
Element selection by reference−>
Element selection through pointer++
--
Prefix increment and decrementRight-to-left+
−
Unary plus and minus!
~
Logical NOT and bitwise NOT(type)
Type cast*
Indirection (dereference)&
Address-ofsizeof
Size-ofnew
, new[]
Dynamic memory allocationdelete
, delete[]
Dynamic memory deallocation.*
->*
Pointer to memberLeft-to-right*
/
%
Multiplication, division, and remainder+
−
Addition and subtraction<<
>>
Bitwise left shift and right shift<
<=
For relational operators < and ≤ respectively>
>=
For relational operators > and ≥ respectively==
!=
For relational = and ≠ respectively&
Bitwise AND^
Bitwise XOR (exclusive or)|
Bitwise OR (inclusive or)&&
Logical AND||
Logical OR?:
Ternary conditionalRight-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 ORthrow
Throw operator (for exceptions),
CommaLeft-to-right++
--
Suffix/postfix increment and decrementLeft-to-right()
Function call[]
Array subscripting.
Structure and union member access−>
Structure and union member access through pointer(type){list}
Compound literal(C99)++
--
Prefix increment and decrementRight-to-left+
−
Unary plus and minus!
~
Logical NOT and bitwise NOT(type)
Type cast*
Indirection (dereference)&
Address-ofsizeof
Size-of_Alignof
Alignment requirement(C11)*
/
%
Multiplication, division, and remainderLeft-to-right+
−
Addition and subtraction<<
>>
Bitwise left shift and right shift<
<=
For relational operators < and ≤ respectively>
>=
For relational operators > and ≥ respectively==
!=
For relational = and ≠ respectively&
Bitwise AND^
Bitwise XOR (exclusive or)|
Bitwise OR (inclusive or)&&
Logical AND||
Logical OR?:
Ternary conditionalRight-to-Left=
Simple assignment+=
−=
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,
CommaLeft-to-rightclone new
clone 和 new左[
array()非结合++ --
递增/递减运算符非结合~ - (int) (float) (string) (array) (object) (bool) @
类型非结合instanceof
类型右结合!
逻辑操作符左* / %
算术运算符左+ - .
算术运算符 和 字符串运算符左<< >>
位运算符非结合< <= > >= <>
比较运算符非结合== != === !==
比较运算符左&
位运算符 和 引用左^
位运算符左|
位运算符左&&
逻辑运算符左||
逻辑运算符左? :
三元运算符右= += -= *= /= .= %= &= |= ^= <<= >>=
赋值运算符左and
逻辑运算符左xor
逻辑运算符左or
逻辑运算符左,
多处用到这个表给出Python的运算符优先级(从低到高).
从最低的优先级(最松散地结合)到最高的优先级(最紧密地结合)。
这意味着在一个表达式中,Python会首先计算表中较下面的运算符,然后在计算列在表上部的运算符。
lambda
Lambda表达式or
布尔“或”and
布尔“与”not x
布尔“非”in,not in
成员测试is,is not
同一性测试<,<=,>,>=,!=,==
比较|
按位或^
按位异或&
按位与<<,>>
移位+,-
加法与减法*,/,%
乘法、除法与取余+x,-x
正负号~x
按位翻转**
指数x.attribute
属性参考x[index]
下标x[index:index]
寻址段f(arguments...)
函数调用(experession,...)
绑定或元组显示[expression,...]
列表显示{key:datum,...}
字典显示'expression,...'
字符串转换出自:http://tool.oschina.net/commons?type=6
0 0
- 运算符优先级-C++运算符优先级
- 运算符优先级-Java 运算符优先级
- 运算符优先级-Python 运算符优先级
- 运算符优先级-PHP运算符优先级
- 运算符优先级
- c 运算符 优先级
- JScript 运算符优先级
- C++运算符优先级
- c 运算符 优先级
- c++运算符优先级
- c++运算符优先级
- C++运算符优先级
- C++ 运算符优先级
- 运算符优先级
- 运算符优先级
- 运算符 优先级
- 运算符的优先级
- 运算符优先级问题
- servlet之ServletContext
- [JAVA · 初级]:4.深入理解自增&自减运算
- Android Activity学习 <一> Activity基础知识和生命周期
- java中的常用包
- mysql连接数设置
- 运算符优先级
- Hadoop 完全分布式集群配置
- Effective C++ 学习心得——构造,析构,赋值运算
- Android横竖屏切换Activity生命周期变化
- day22:RDD的依赖关系彻底解密
- day21:从Spark架构中透视Job
- 《Linux总线、设备与驱动》USBHID设备驱动
- Android环境搭建(不需要翻墙,直接配置安装开发环境)
- hrbust 1283 又见皇后【dfs】