Binary expressions
A binary expression contains two operands separated by one
operator. The supported binary operators are:
- Assignment operators
- Multiplication operator *
- Division operator ⁄
- Remainder operator %
- Addition operator +
- Subtraction operator -
- Bitwise left and right shift operators << >>
- Relational operators < > <= >=
- Equality and inequality operators == !=
- Bitwise AND operator &
- Bitwise exclusive OR operator ^
- Bitwise inclusive OR operator |
- Logical AND operator &&
- Logical OR operator ||
- Array subscripting operator [ ]
- Comma operator ,
- Pointer to member operators .* ->* (C++ only)
All binary operators have left-to-right associativity, but not all binary operators have the same precedence. The ranking and precedence rules for binary operators is summarized in Table 3.
The order in which the operands of most binary operators are evaluated is not specified. To ensure correct results, avoid creating binary expressions that depend on the order in which the compiler evaluates the operands.
As indicated in the descriptions of the operators, the usual arithmetic conversions are performed on the operands of most binary expressions.
Related information