C has several assignment operators. The most basic one, of course, is =, which simply assigns the value of the expression at its right to the variable at its left. The other assignment operators update variables. Each is used with a variable name to its left and an expression to its right. The variable is assigned a new value equal to its old value adjusted by the value of the expression at the right. The exact adjustment depends on the operator, for example,
scores += 20 | is the same as | scores = scores + 20 |
dimes -= 2 | is the same as | dimes = dimes - 2 |
bunnies *= 2 | is the same as | bunnies = bunnies * 2 |
time /= 2.73 | is the same as | time = time / 2.73 |
reduce %= 3 | is the same as | reduce = reduce % 3 |
The ...
No credit card required