Arithmetic Operators
+ adds the value at its right to the value at its left.
- subtracts the value at its right from the value at its left.
-, as a unary operator, changes the sign of the value at its right.
* multiplies the value at its right by the value at its left.
/ divides the value at its left by the value at its right. Answer is truncated if both operands are integers.
% yields the remainder when the value at its left is divided by the value to its right (integers only).
++ adds 1 to the value of the variable to its right (prefix mode) or adds 1 to the value of the variable to its left (postfix mode).
- is like ++, but subtracts 1.
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.