From greatest to smallest priority, C++ operators are evaluated in the following order: =============================================================================================== =============================================================================================== Level Precedence group Operator Description Grouping =============================================================================================== 1 Scope :: scope qualifier Left-to-right ----------------------------------------------------------------------------------------------- 2 Postfix (unary) ++ -- increment/decrement Left-to-right () functional forms [] subscript . -> member access ----------------------------------------------------------------------------------------------- 3 Prefix (unary) ++ -- increment/decrement Right-to-left ~ ! bitwise NOT/logical NOT + - unary prefix & * reference/dereference new delete allocation/deallocation sizeof parameter pack (type) C-style type-casting ----------------------------------------------------------------------------------------------- 4 Pointer-to-member .* ->* access pointer Left-to-right ----------------------------------------------------------------------------------------------- 5 Arithmetic: scaling * / % multiply, divide, modulo Left-to-right ----------------------------------------------------------------------------------------------- 6 Arithmetic: addition + - addition, subtraction Left-to-right ----------------------------------------------------------------------------------------------- 7 Bitwise shift << >> shift left, shift right Left-to-right ----------------------------------------------------------------------------------------------- 8 Relational < > <= >= comparison operators Left-to-right ----------------------------------------------------------------------------------------------- 9 Equality == != equality / inequality Left-to-right ----------------------------------------------------------------------------------------------- 10 And & bitwise AND Left-to-right ----------------------------------------------------------------------------------------------- 11 Exclusive or ^ bitwise XOR Left-to-right ----------------------------------------------------------------------------------------------- 12 Inclusive or | bitwise OR Left-to-right ----------------------------------------------------------------------------------------------- 13 Conjunction && logical AND Left-to-right ----------------------------------------------------------------------------------------------- 14 Disjunction || logical OR Left-to-right ----------------------------------------------------------------------------------------------- 15 Assignment-level exp. = *= /= %= += -= >>= <<= &= ^= |= assignment/compound asg Right-to-left ------------------------------------------------------------------ ?: conditional operator ----------------------------------------------------------------------------------------------- 16 Sequencing , comma separator Left-to-right =============================================================================================== =============================================================================================== When an expression has two operators with the same precedence level, grouping determines which one is evaluated first: either left-to-right or right-to-left. Enclosing all sub-statements in parentheses (even those unnecessary because of their precedence) improves code readability.