|
|
In C/C++, the assignment operator is the single equal sign. When assigning a common value to several values, you can “string together” several assignments. For example,
a = b = c = 10;
assigns a, b, and c the value 10.
There is a convenient “shorthand” for assignments that have this general form:
var = var op expression;
Assignments of this type can be shortened to
var op = expression;
For example, these two assignments
x = x+10; y = y/z;
can be recoded as shown here:
x += 10; y /= z;
|
|