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
typeid()
run-time type information (see typeid
)const_cast
type cast (see const_cast
)dynamic_cast
type cast (see dynamic_cast
)reinterpret_cast
type cast (see reinterpret_cast
)static_cast
type cast (see static_cast)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
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
17throw
throw operator (exceptions throwing)
18,
comma
left-to-right
運算子優先順序 C 運算子優先順序
c 運算子優先順序 優先順序運算子 描述方向1 scope resolution 範圍解析 left to right 2 suffix postfix increment and decrement 字首 字尾遞增和遞減 function call 函式呼叫 array subscripting ...
運算子優先順序 Python 運算子優先順序
python 運算子優先順序 運算子描述 lambda lambda表示式 or布林 或 and布林 與 not x 布林 非 in,not in 成員測試 is,is not 同一性測試 比較 按位或 按位異或 按位與 移位 加法與減法 乘法 除法與取餘 x,x 正負號 x 按位翻轉 指數 x.a...
運算子優先順序 PHP運算子優先順序
php運算子優先順序 結合方向 運算子附加資訊 非結合clone new clone 和 new左 array 非結合 遞增 遞減運算子 非結合 int float string array object bool 型別非結合 instanceof 型別右結合 邏輯操作符 左 算術運算子 左 算術運...