Working with C++ Expressions

Expressions consist of operands and operators. Operands are anything that have a typed value, that is, variables, function return values, or expressions, which in turn consist of operators and operands. Operators are symbols whose meaning is reserved in C++. Application of an operator to operand(s) results in a value that can be used in another expression. White space is useful for readability but is not required.

     x = (a + b) * (a + 2*b) * (a+3*b);     // space is optional

Two operator attributes affect the order of evaluation: operator precedence level (higher level operators are performed first), and operator associativity (operators of the same precedence are evaluated either from left to right or from right to ...

Get Core C++ A Software Engineering Approach now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.