欢迎来到[自学php网] ①群 287460651

主页 > 专题教程 > 常用语言参考表 >

C++运算符优先级

来源:未知    时间:2018-11-03 14:50 作者:小飞侠

[导读] C++运算符优先级 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 selec...

C++运算符优先级
PrecedenceOperatorDescriptionAssociativity
1::Scope resolutionLeft-to-right
2++   --Suffix/postfix increment and decrement
()Function call
[]Array subscripting
.Element selection by reference
−>Element selection through pointer
3++   --Prefix increment and decrementRight-to-left
+   Unary plus and minus
!   ~Logical NOT and bitwise NOT
(type)Type cast
*Indirection (dereference)
&Address-of
sizeofSize-of
new, new[]Dynamic memory allocation
delete, delete[]Dynamic memory deallocation
4.*   ->*Pointer to memberLeft-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 conditionalRight-to-Left
16=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
17throwThrow operator (for exceptions)
18,CommaLeft-to-right

最新文章

点击排行

自学PHP网专注网站建设学习,PHP程序学习,平面设计学习,以及操作系统学习

京ICP备14009008号@版权所有www.zixuephp.com

网站声明:本站所有视频,教程都由网友上传,站长收集和分享给大家学习使用,如由牵扯版权问题请联系站长邮箱904561283@qq.com