19.1.  Operators

[ fromfile: operators.xml id: operators ]

Operators fall into broad classifications according to their primary use.

Assignment operators =, +=, *=, ...
Arithmetic operators +, -, *, /, %
Relational operators <, <=, >, >=, ==, !=
Logical operators &&, ||, !
Bitwise operators &, |, ^, ~, <<, >>
Memory management operators new, delete, sizeof
Pointer and access operators *, &, ., ->, []
Scope resolution operators ::
Miscellaneous operatorsconditional(?:), comma(,)

Operators have predefined meanings for built-in types, but not all operators are defined for all built-in types.

Operator Characteristics

Operators have the following special characteristics:

Table 19.1 lists all the C++ operators and their characteristics, grouped by precedence and purpose, with groups of highest precedence listed first.