O'Reilly logo

Navigating C++ and Object-Oriented Design by Gail Anderson, Paul Anderson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

2.5. Operators and Expressions

Operators let you manipulate variables and build expressions. Operands are the variables or other expressions that operators manipulate. Many operators have restrictions that apply to an operand's data type. We group most of the operators into separate tables according to their precedence, or order of evaluation. Appendix C contains a precedence table for all C++ operators (see Table C.1, “C++ operator precedence,” on page 776).

Arithmetic Operators

Table 2.5 lists the arithmetic operators in C++.

Table 2.5. Arithmetic operators
Operator Meaning Example
- unary minus -x
* multiplication x * y
/ division x / y
% modulus x % y
+ addition x + y
- subtraction x - y

The compiler generates assembly code for integer or ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required