Assignment Operators

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;

C(s)C++ Programmer's Reference
C Programming on the IBM PC (C Programmers Reference Guide Series)
ISBN: 0673462897
EAN: 2147483647
Year: 2002
Pages: 539 © 2008-2017.
If you may any questions please contact us: