0% found this document useful (0 votes)
83 views1 page

C++ Operator Precedence Guide

The document lists C++ operators in order of precedence from highest to lowest, along with their associativity. It includes unary, binary, and ternary operators as well as operators for memory allocation and type casting. The highest precedence operators are scope resolution, function calls, and array subscripting. Lower precedence operators include arithmetic, comparison, logical, bitwise, and assignment.

Uploaded by

ukhyeon
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
83 views1 page

C++ Operator Precedence Guide

The document lists C++ operators in order of precedence from highest to lowest, along with their associativity. It includes unary, binary, and ternary operators as well as operators for memory allocation and type casting. The highest precedence operators are scope resolution, function calls, and array subscripting. Lower precedence operators include arithmetic, comparison, logical, bitwise, and assignment.

Uploaded by

ukhyeon
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Precedence 1 highest

Operator :: ++ -() [] . -> typeid() const_cast dynamic_cast reinterpret_cast static_cast ++ -+ ! ~ (type) * & sizeof new, new[] delete, delete[] .* ->* * / % + << >> < <= > >= == != & ^ | && || ?: = += -= *= /= %= <<= >>= &= ^= |= throw ,

Description Scope resolution (C++ only) Suffix increment Suffix decrement Function call Array subscripting Element selection by reference Element selection through pointer Run-time type information (C++ only) (see typeid) Type cast (C++ only) (see const cast) Type cast (C++ only) (see dynamic_cast) Type cast (C++ only) (see reinterpret cast) Type cast (C++ only) (see static cast) Prefix increment Prefix decrement Unary plus Unary minus Logical NOT Bitwise NOT Type cast Indirection (dereference) Address-of Size-of Dynamic memory allocation (C++ only) Dynamic memory deallocation (C++ only) Pointer to member (C++ only) Pointer to member (C++ only) Multiplication Division Modulo (remainder) Addition Subtraction Bitwise left shift Bitwise right shift Less than Less than or equal to Greater than Greater than or equal to Equal to Not equal to Bitwise AND Bitwise XOR (exclusive or) Bitwise OR (inclusive or) Logical AND Logical OR Ternary conditional (see ?:) Direct assignment Assignment by sum Assignment by difference Assignment by product Assignment by quotient Assignment by remainder Assignment by bitwise left shift Assignment by bitwise right shift Assignment by bitwise AND Assignment by bitwise XOR Assignment by bitwise OR Throw operator (exceptions throwing, C++ only) Comma

Associativity Left-to-right

Right-to-left

4 5 6 7

Left-to-right

9 10 11 12 13 14 15

Right-to-left

16

17 18

Left-to-righ

You might also like