Assignment Operators

= assigns the value at its right to the lvalue on its left.

Each of the following assignment operators updates the lvalue at its left by the value at its right, using the indicated operation. We use R-H for right-hand and L-H for left-hand.

+= adds the R-H quantity to the L-H variable and places the result in the L-H variable.

-= subtracts the R-H quantity from the L-H variable and places the result in the L-H variable.

*= multiplies the L-H variable by the R-H quantity and places the result in the L-H variable.

/= divides the L-H variable by the R-H quantity and places the result in the L-H variable.

%= gives the remainder from dividing the L-H quantity by the R-H quantity and places the result in the L-H variable.

&= assigns ...

Get C Primer Plus®, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.