
2.4 Expressions and Arithmetic Operators 63
2.4 Expressions and Arithmetic Operators
2.4.1 The Assignment Operator and Expressions
In the previous section, we mentioned using the assignment operator to
assign initial values to variables and constants. Now let’s look at the assign-
ment operator in more detail.
The syntax for the assignment operator is:
target = expression;
An expression consists of operators and operands that evaluate to a single
value. The value of the expression is then assigned to target, which must be
a variable or constant having a data type compatible with the value of the
expression.
If target is a variable, the value of the expression ...