c++操作符及其优先级

来源:互联网 发布:网络拓扑结构概念 编辑:程序博客网 时间:2024/06/11 20:12

http://www.cplusplus.com/doc/tutorial/operators/


LevelPrecedence groupOperatorDescriptionGrouping1Scope::scope qualifierLeft-to-right2Postfix (unary)++ --postfix increment / decrementLeft-to-right()functional forms[]subscript. ->member access3Prefix (unary)++ --prefix increment / decrementRight-to-left~ !bitwise NOT / logical NOT+ -unary prefix& *reference / dereferencenew deleteallocation / deallocationsizeofparameter pack(type)C-style type-casting4Pointer-to-member.* ->*access pointerLeft-to-right5Arithmetic: scaling* / %multiply, divide, moduloLeft-to-right6Arithmetic: addition+ -addition, subtractionLeft-to-right7Bitwise shift<< >>shift left, shift rightLeft-to-right8Relational< > <= >=comparison operatorsLeft-to-right9Equality== !=equality / inequalityLeft-to-right10And&bitwise ANDLeft-to-right11Exclusive or^bitwise XORLeft-to-right12Inclusive or|bitwise ORLeft-to-right13Conjunction&&logical ANDLeft-to-right14Disjunction||logical ORLeft-to-right15Assignment-level expressions= *= /= %= += -=
>>= <<= &= ^= |=
assignment / compound assignmentRight-to-left?:conditional operator16Sequencing,comma separatorLeft-to-right

0 0
原创粉丝点击