1 Answers
An assignment statement evaluates the expression on the right side of the equal sign first and then assigns that value to the variable on the left side of the =. This makes it possible to use the same variable on both sides of an assignment statement, which is frequently done in programming. For example:
int x = 3;
x = x + 1; /* x is now 4 */
To shorten this type of assignment statement, C offers the += assignment operator. The statement above can be written as
x += 1; /* x = x + 1 */