The assignment operator,
=
, like all operators in C,
produces a value. By convention, the value produced is the
same as the value assigned. Thus, the value of the expression
y = 5
is 5.
Accordingly, assignment expressions can appear as subexpressions
nested inside larger expressions.
In the following assignment expression, for example, the assignment
expression, y = 5
, which assigns a value to y
, appears inside
a larger assignment expression, which assigns a value to x
as well:
x = (y = 5)
When the assignment expression is evaluated, 5
is assigned to
y
first; then, the value of the subexpression, which is also
5
, is assigned to x
.