---
# System prepended metadata

title: 運算子優先等級
tags: [C++Book]

---

# 運算子優先等級
###### tags: `C++Book`

### C++ 運算子的優先順序和順序關聯性[](https://docs.microsoft.com/zh-tw/cpp/cpp/cpp-built-in-operators-precedence-and-associativity?view=vs-2019#c-operator-precedence-and-associativity)

| 運算子描述 | 運算子 |
| --- | --- |
| **群組 1 的優先順序、 沒有關聯性** |  |
| [範圍解析](https://docs.microsoft.com/zh-tw/cpp/cpp/scope-resolution-operator?view=vs-2019) | [::](https://docs.microsoft.com/zh-tw/cpp/cpp/scope-resolution-operator?view=vs-2019) |
| **群組 2 的優先順序，由左到右的順序關聯性** |  |
| [成員選取 （物件或指標）](https://docs.microsoft.com/zh-tw/cpp/cpp/member-access-operators-dot-and?view=vs-2019) | [.或->](https://docs.microsoft.com/zh-tw/cpp/cpp/member-access-operators-dot-and?view=vs-2019) |
| [陣列註標](https://docs.microsoft.com/zh-tw/cpp/cpp/subscript-operator?view=vs-2019) | [\[\]](https://docs.microsoft.com/zh-tw/cpp/cpp/subscript-operator?view=vs-2019) |
| [函式呼叫](https://docs.microsoft.com/zh-tw/cpp/cpp/function-call-operator-parens?view=vs-2019) | [()](https://docs.microsoft.com/zh-tw/cpp/cpp/function-call-operator-parens?view=vs-2019) |
| [後置遞增](https://docs.microsoft.com/zh-tw/cpp/cpp/postfix-increment-and-decrement-operators-increment-and-decrement?view=vs-2019) | [++](https://docs.microsoft.com/zh-tw/cpp/cpp/postfix-increment-and-decrement-operators-increment-and-decrement?view=vs-2019) |
| [後置遞減](https://docs.microsoft.com/zh-tw/cpp/cpp/postfix-increment-and-decrement-operators-increment-and-decrement?view=vs-2019) | [--](https://docs.microsoft.com/zh-tw/cpp/cpp/postfix-increment-and-decrement-operators-increment-and-decrement?view=vs-2019) |
| [類型名稱](https://docs.microsoft.com/zh-tw/cpp/cpp/typeid-operator?view=vs-2019) | [typeid](https://docs.microsoft.com/zh-tw/cpp/cpp/typeid-operator?view=vs-2019) |
| [常數的類型轉換](https://docs.microsoft.com/zh-tw/cpp/cpp/const-cast-operator?view=vs-2019) | [const_cast](https://docs.microsoft.com/zh-tw/cpp/cpp/const-cast-operator?view=vs-2019) |
| [動態類型轉換](https://docs.microsoft.com/zh-tw/cpp/cpp/dynamic-cast-operator?view=vs-2019) | [dynamic_cast](https://docs.microsoft.com/zh-tw/cpp/cpp/dynamic-cast-operator?view=vs-2019) |
| [已轉換的型別轉換](https://docs.microsoft.com/zh-tw/cpp/cpp/reinterpret-cast-operator?view=vs-2019) | [reinterpret_cast](https://docs.microsoft.com/zh-tw/cpp/cpp/reinterpret-cast-operator?view=vs-2019) |
| [靜態型別轉換](https://docs.microsoft.com/zh-tw/cpp/cpp/static-cast-operator?view=vs-2019) | [static_cast](https://docs.microsoft.com/zh-tw/cpp/cpp/static-cast-operator?view=vs-2019) |
| **群組 3 的優先順序，從右至左順序關聯性** |  |
| [物件或類型的大小](https://docs.microsoft.com/zh-tw/cpp/cpp/sizeof-operator?view=vs-2019) | [sizeof](https://docs.microsoft.com/zh-tw/cpp/cpp/sizeof-operator?view=vs-2019) |
| [前置遞增](https://docs.microsoft.com/zh-tw/cpp/cpp/prefix-increment-and-decrement-operators-increment-and-decrement?view=vs-2019) | [++](https://docs.microsoft.com/zh-tw/cpp/cpp/prefix-increment-and-decrement-operators-increment-and-decrement?view=vs-2019) |
| [前置遞減](https://docs.microsoft.com/zh-tw/cpp/cpp/prefix-increment-and-decrement-operators-increment-and-decrement?view=vs-2019) | [--](https://docs.microsoft.com/zh-tw/cpp/cpp/prefix-increment-and-decrement-operators-increment-and-decrement?view=vs-2019) |
| [一補數](https://docs.microsoft.com/zh-tw/cpp/cpp/one-s-complement-operator-tilde?view=vs-2019) | [~](https://docs.microsoft.com/zh-tw/cpp/cpp/one-s-complement-operator-tilde?view=vs-2019) |
| [邏輯 not](https://docs.microsoft.com/zh-tw/cpp/cpp/logical-negation-operator-exclpt?view=vs-2019) | [!](https://docs.microsoft.com/zh-tw/cpp/cpp/logical-negation-operator-exclpt?view=vs-2019) |
| [一元否定運算](https://docs.microsoft.com/zh-tw/cpp/cpp/unary-plus-and-negation-operators-plus-and?view=vs-2019) | [-](https://docs.microsoft.com/zh-tw/cpp/cpp/unary-plus-and-negation-operators-plus-and?view=vs-2019) |
| [一元加號](https://docs.microsoft.com/zh-tw/cpp/cpp/unary-plus-and-negation-operators-plus-and?view=vs-2019) | [+](https://docs.microsoft.com/zh-tw/cpp/cpp/unary-plus-and-negation-operators-plus-and?view=vs-2019) |
| [Address-of](https://docs.microsoft.com/zh-tw/cpp/cpp/address-of-operator-amp?view=vs-2019) | [&](https://docs.microsoft.com/zh-tw/cpp/cpp/address-of-operator-amp?view=vs-2019) |
| [間接取值](https://docs.microsoft.com/zh-tw/cpp/cpp/indirection-operator-star?view=vs-2019) | [*](https://docs.microsoft.com/zh-tw/cpp/cpp/indirection-operator-star?view=vs-2019) |
| [建立物件](https://docs.microsoft.com/zh-tw/cpp/cpp/new-operator-cpp?view=vs-2019) | [new](https://docs.microsoft.com/zh-tw/cpp/cpp/new-operator-cpp?view=vs-2019) |
| [終結物件](https://docs.microsoft.com/zh-tw/cpp/cpp/delete-operator-cpp?view=vs-2019) | [delete](https://docs.microsoft.com/zh-tw/cpp/cpp/delete-operator-cpp?view=vs-2019) |
| [Cast](https://docs.microsoft.com/zh-tw/cpp/cpp/cast-operator-parens?view=vs-2019) | [()](https://docs.microsoft.com/zh-tw/cpp/cpp/cast-operator-parens?view=vs-2019) |
| **群組 4 優先順序，由左到右的順序關聯性** |  |
| [指標成員 （物件或指標）](https://docs.microsoft.com/zh-tw/cpp/cpp/pointer-to-member-operators-dot-star-and-star?view=vs-2019) | [.*或->*](https://docs.microsoft.com/zh-tw/cpp/cpp/pointer-to-member-operators-dot-star-and-star?view=vs-2019) |
| **群組 5 優先順序，由左到右的順序關聯性** |  |
| [乘法](https://docs.microsoft.com/zh-tw/cpp/cpp/multiplicative-operators-and-the-modulus-operator?view=vs-2019) | [*](https://docs.microsoft.com/zh-tw/cpp/cpp/multiplicative-operators-and-the-modulus-operator?view=vs-2019) |
| [除法](https://docs.microsoft.com/zh-tw/cpp/cpp/multiplicative-operators-and-the-modulus-operator?view=vs-2019) | [/](https://docs.microsoft.com/zh-tw/cpp/cpp/multiplicative-operators-and-the-modulus-operator?view=vs-2019) |
| [模數](https://docs.microsoft.com/zh-tw/cpp/cpp/multiplicative-operators-and-the-modulus-operator?view=vs-2019) | [%](https://docs.microsoft.com/zh-tw/cpp/cpp/multiplicative-operators-and-the-modulus-operator?view=vs-2019) |
| **群組 6 優先順序，由左到右的順序關聯性** |  |
| [加法](https://docs.microsoft.com/zh-tw/cpp/cpp/additive-operators-plus-and?view=vs-2019) | [+](https://docs.microsoft.com/zh-tw/cpp/cpp/additive-operators-plus-and?view=vs-2019) |
| [減法](https://docs.microsoft.com/zh-tw/cpp/cpp/additive-operators-plus-and?view=vs-2019) | [-](https://docs.microsoft.com/zh-tw/cpp/cpp/additive-operators-plus-and?view=vs-2019) |
| **群組 7 優先順序，由左到右的順序關聯性** |  |
| [左的移](https://docs.microsoft.com/zh-tw/cpp/cpp/left-shift-and-right-shift-operators-input-and-output?view=vs-2019) | [<<](https://docs.microsoft.com/zh-tw/cpp/cpp/left-shift-and-right-shift-operators-input-and-output?view=vs-2019) |
| [向右移位](https://docs.microsoft.com/zh-tw/cpp/cpp/left-shift-and-right-shift-operators-input-and-output?view=vs-2019) | [>>](https://docs.microsoft.com/zh-tw/cpp/cpp/left-shift-and-right-shift-operators-input-and-output?view=vs-2019) |
| **群組 8 優先順序，由左到右的順序關聯性** |  |
| [小於](https://docs.microsoft.com/zh-tw/cpp/cpp/relational-operators-equal-and-equal?view=vs-2019) | [<](https://docs.microsoft.com/zh-tw/cpp/cpp/relational-operators-equal-and-equal?view=vs-2019) |
| [大於](https://docs.microsoft.com/zh-tw/cpp/cpp/relational-operators-equal-and-equal?view=vs-2019) | [>](https://docs.microsoft.com/zh-tw/cpp/cpp/relational-operators-equal-and-equal?view=vs-2019) |
| [小於或等於](https://docs.microsoft.com/zh-tw/cpp/cpp/relational-operators-equal-and-equal?view=vs-2019) | [<=](https://docs.microsoft.com/zh-tw/cpp/cpp/relational-operators-equal-and-equal?view=vs-2019) |
| [大於或等於](https://docs.microsoft.com/zh-tw/cpp/cpp/relational-operators-equal-and-equal?view=vs-2019) | [>=](https://docs.microsoft.com/zh-tw/cpp/cpp/relational-operators-equal-and-equal?view=vs-2019) |
| **群組 9 的優先順序，由左到右的順序關聯性** |  |
| [相等](https://docs.microsoft.com/zh-tw/cpp/cpp/equality-operators-equal-equal-and-exclpt-equal?view=vs-2019) | [==](https://docs.microsoft.com/zh-tw/cpp/cpp/equality-operators-equal-equal-and-exclpt-equal?view=vs-2019) |
| [不等](https://docs.microsoft.com/zh-tw/cpp/cpp/equality-operators-equal-equal-and-exclpt-equal?view=vs-2019) | [!=](https://docs.microsoft.com/zh-tw/cpp/cpp/equality-operators-equal-equal-and-exclpt-equal?view=vs-2019) |
| **群組 10 優先順序由左到右的順序關聯性** |  |
| [位元 AND](https://docs.microsoft.com/zh-tw/cpp/cpp/bitwise-and-operator-amp?view=vs-2019) | [&](https://docs.microsoft.com/zh-tw/cpp/cpp/bitwise-and-operator-amp?view=vs-2019) |
| **群組 11 優先順序，由左到右的順序關聯性** |  |
| [位元互斥 OR](https://docs.microsoft.com/zh-tw/cpp/cpp/bitwise-exclusive-or-operator-hat?view=vs-2019) | [^](https://docs.microsoft.com/zh-tw/cpp/cpp/bitwise-exclusive-or-operator-hat?view=vs-2019) |
| **群組 12 優先順序，由左到右的順序關聯性** |  |
| [位元包含 OR](https://docs.microsoft.com/zh-tw/cpp/cpp/bitwise-inclusive-or-operator-pipe?view=vs-2019) | [|](https://docs.microsoft.com/zh-tw/cpp/cpp/bitwise-inclusive-or-operator-pipe?view=vs-2019) |
| **群組 13 優先順序，由左到右的順序關聯性** |  |
| [邏輯 AND](https://docs.microsoft.com/zh-tw/cpp/cpp/logical-and-operator-amp-amp?view=vs-2019) | [&&](https://docs.microsoft.com/zh-tw/cpp/cpp/logical-and-operator-amp-amp?view=vs-2019) |
| **群組 14 優先順序，由左到右的順序關聯性** |  |
| [邏輯 OR](https://docs.microsoft.com/zh-tw/cpp/cpp/logical-or-operator-pipe-pipe?view=vs-2019) | [||](https://docs.microsoft.com/zh-tw/cpp/cpp/logical-or-operator-pipe-pipe?view=vs-2019) |
| **群組 15 的優先順序，從右至左順序關聯性** |  |
| [Conditional](https://docs.microsoft.com/zh-tw/cpp/cpp/conditional-operator-q?view=vs-2019) | [? :](https://docs.microsoft.com/zh-tw/cpp/cpp/conditional-operator-q?view=vs-2019) |
| **群組 16 優先順序，從右至左順序關聯性** |  |
| [指派](https://docs.microsoft.com/zh-tw/cpp/cpp/assignment-operators?view=vs-2019) | [=](https://docs.microsoft.com/zh-tw/cpp/cpp/assignment-operators?view=vs-2019) |
| [乘法指派](https://docs.microsoft.com/zh-tw/cpp/cpp/assignment-operators?view=vs-2019) | [*=](https://docs.microsoft.com/zh-tw/cpp/cpp/assignment-operators?view=vs-2019) |
| [除法指派](https://docs.microsoft.com/zh-tw/cpp/cpp/assignment-operators?view=vs-2019) | [/=](https://docs.microsoft.com/zh-tw/cpp/cpp/assignment-operators?view=vs-2019) |
| [模數指派](https://docs.microsoft.com/zh-tw/cpp/cpp/assignment-operators?view=vs-2019) | [%=](https://docs.microsoft.com/zh-tw/cpp/cpp/assignment-operators?view=vs-2019) |
| [加法指派](https://docs.microsoft.com/zh-tw/cpp/cpp/assignment-operators?view=vs-2019) | [+=](https://docs.microsoft.com/zh-tw/cpp/cpp/assignment-operators?view=vs-2019) |
| [減法指派](https://docs.microsoft.com/zh-tw/cpp/cpp/assignment-operators?view=vs-2019) | [-=](https://docs.microsoft.com/zh-tw/cpp/cpp/assignment-operators?view=vs-2019) |
| [左移指派](https://docs.microsoft.com/zh-tw/cpp/cpp/assignment-operators?view=vs-2019) | [<<=](https://docs.microsoft.com/zh-tw/cpp/cpp/assignment-operators?view=vs-2019) |
| [右移指派](https://docs.microsoft.com/zh-tw/cpp/cpp/assignment-operators?view=vs-2019) | [>>=](https://docs.microsoft.com/zh-tw/cpp/cpp/assignment-operators?view=vs-2019) |
| [位元 AND 指派](https://docs.microsoft.com/zh-tw/cpp/cpp/assignment-operators?view=vs-2019) | [&=](https://docs.microsoft.com/zh-tw/cpp/cpp/assignment-operators?view=vs-2019) |
| [位元包含 OR 指派](https://docs.microsoft.com/zh-tw/cpp/cpp/assignment-operators?view=vs-2019) | [|=](https://docs.microsoft.com/zh-tw/cpp/cpp/assignment-operators?view=vs-2019) |
| [位元互斥 OR 指派](https://docs.microsoft.com/zh-tw/cpp/cpp/assignment-operators?view=vs-2019) | [^=](https://docs.microsoft.com/zh-tw/cpp/cpp/assignment-operators?view=vs-2019) |
| **群組 17 優先順序，從右至左順序關聯性** |  |
| [擲回運算式](https://docs.microsoft.com/zh-tw/cpp/cpp/try-throw-and-catch-statements-cpp?view=vs-2019) | [throw](https://docs.microsoft.com/zh-tw/cpp/cpp/try-throw-and-catch-statements-cpp?view=vs-2019) |
| **群組 18 優先順序，由左到右的順序關聯性** |  |
| [逗號](https://docs.microsoft.com/zh-tw/cpp/cpp/comma-operator?view=vs-2019) |
