This is a list of operators in the C and C++ programming languages. All the operators listed exist in C++; the fourth column "Included in C", states whether an operator is also present in C. Note that C does not support operator overloading.
When not overloaded, for the operators &&
, ||
, and ,
(the comma operator), there is a sequence point after the evaluation of the first operand.
C++ also contains the type conversion operators const_cast
, static_cast
, dynamic_cast
, and reinterpret_cast
. The formatting of these operators means that their precedence level is unimportant.
Most of the operators available in C and C++ are also available in other languages such as C#, D, Java, Perl, and PHP with the same precedence, associativity, and semantics.
For the purposes of these tables, a
, b
, and c
represent valid values (literals, values from variables, or return value), object names, or lvalues, as appropriate. R
, S
and T
stand for any type(s), and K
for a class type or enumerated type.
Notes:
The following is a table that lists the precedence and associativity of all the operators in the C and C++ languages (when the operators also exist in Java, Perl, PHP and many other recent languages, the precedence is the same as that given). Operators are listed top to bottom, in descending precedence. Descending precedence refers to the priority of the grouping of operators and operands. Considering an expression, an operator which is listed on some row will be grouped prior to any operator that is listed on a row further below it. Operators that are in the same cell (there may be several rows of operators listed in a cell) are grouped with the same precedence, in the given direction. An operator's precedence is unaffected by overloading.