You are on page 1of 2

The highest precedence operators appear first in the list.

Operators in the same box each have equal precedence, and the order of application depends on the associativity labeled in the rightmost column.

C++ Operator Precedence Chart

Operator :: :: () [] . -> ++ -typeid dynamic_cast< type > static_cast reinterpret_cast const_cast ++ -+ ! ~ ( type ) sizeof & * new new[] delete delete[]

Type binary scope resolution unary scope resolution parentheses array subscript member selection via object member selection via pointer unary postincrement unary postdecrement run-time type information run-time type-checked cast compile-time type-checked cast cast for non-standard conversions cast away const-ness unary preincrement unary predecrement unary plus unary minus unary logical negation unary bitwise complement C-style unary cast determine size in bytes address dereference dynamic memory allocation dynamic array allocation dynamic memory deallocation dynamic array deallocation

Associativity

left to right

right to left

.* ->* * / % + << >> < <= > >= == != & ^ | && || ?: = += -= *= /= %= &= ^= |= >>= <<= ,

pointer to member via object pointer to member via pointer multiplication division modulus addition subtraction bitwise left shift bitwise right shift relational less than relational less than or equal to relational greater than relational greater than or equal to relational is equal to relational is not equal to bitwise AND bitwise exclusive OR bitwise inclusive OR logical AND logical OR ternary conditional assignment addition assignment subtraction assignment multiplication assignment division assignment modulus assignment bitwise AND assignment bitwise exclusive OR assignment bitwise inclusive OR assignment bitwise left shift assignment bitwise right shift with assignment comma left to right

right to left

left to right

This chart was provided by the California State University at Bakersfield Computer Science department, http://www.cs.csubak.edu/. Thanks.

You might also like