C++ Programming Code Examples C++ > Beginners Lab Assignments Code Examples Operators Precedence in C++ Programming Operators Precedence in C++ Programming Operator precedence determines how an expression is evaluated. Some operators will have higher precedence than others. For example, multiplication operator will have higher precedence than addition operator. For example a = 2 + 3 * 5; here, a will be assigned 17, not 25 because operator * has higher precedence than +, so 3*5 gets multiplied first and then 2 gets added to the multiplication result of 3*5. In the table below, operators with the highest precedence appear at the top of the table and operators with the lowest precedence appear at the bottom. In the expression, higher precedence operators will be evaluated first. Operator Category Associativity Precedence () [] -> . ++ - - Postfix Left to right Highest + - ! ~ ++ - - (type)* & sizeof Unary Right to left * / % Multiplicative Left to right + - Additive Left to right << >> Shift Left to right < <= > >= Relational Left to right == != Equality Left to right & Bitwise AND Left to right ^ Bitwise XOR Left to right | Bitwise OR Left to right && Logical AND Left to right || Logical OR Left to right ?: Conditional Right to left = += -= *= /= %=>>= <<= &= ^= |= Assignment Right to left , Comma Left to right Lowest