In its simplest form an expression consists of only one constant, one variable, or one
function call. Expressions can be used as the operands of operators to form more complex
expressions. An expression will generally tend to be a combination of operators and
operands.
Each expression that is not a void type returns a value. In the case of arithmetic
expressions, the operands define the type of the expression.
Examples: int a(4); double x(7.9);
a * 512 // Type int
1.0 + sin(x) // Type double
x – 3 // Type double, since one
// operand is of type double
An expression can be used as an operand in another expression.
Example: 2 + 7 * 3 // Adds 2 and 21
Normal mathematical rules (multiplication before addition) apply when evaluating an
expression, i.e. the *, /, % operators have higher precedence than + and -. In our example,
7*3 is first calculated before adding 2. However, you can use parentheses to apply a
different precedence order.
Example: (2 + 7) * 3 // Multiplies 9 by 3.