Operator precedence
| Precedence (high to low) | Operators | Description |
| 1 | :: | Scope resolution (C++ classes) |
| 2 | ++ -- () [] . -> |
Increment and decrement (suffix and postfix) Function call Array subscript Struct and Union member access Struct and Union member access via pointer |
| 3 | ++ -- + - ! ~ (new type) * & sizeof() |
Increment and decrement (prefix) Unary plus and minus Logical not and bitwise not Explicit cast Dereference (pointer) Address of Sizeof function |
| 4 | * / % | Arithmetic multiply, divide and modulus |
| 5 | + - ++ -- |
Arithmetic plus and minus Increment and decrement (postfix) |
| 6 | << >> | Bit-shift right and left |
| 7 | < <= > >= | Less than, less than or equal, greater than and greater than or equal |
| 8 | == != | Equal and not equal |
| 9 | & | Bitwise and |
| 10 | ^ | Bitwise xor |
| 11 | | | Bitwise or |
| 12 | && | Logical and |
| 13 | || | Logical or |
| 14 | ? : | Ternary conditional |
| 15 | = += -= *= /= %= <<= >>= &= != ^= |
Assignment Compound arithmetic operators Compound bit-shift operators Compound bitwise assignment |
| 16 | , | Comma |
Overloaded operators that you might add in code retain their place in the precedence hierarchy.