These require two operands (numbers or variables) to perform a calculation.
| Operator | Operation | Example (a=10,b=3) | Result |
| + | Addition | $a + b$ | $13$ |
| - | Subtraction | $a - b$ | $7$ |
| * | Multiplication | $a * b$ | $30$ |
| / | Division | $a / b$ | $3$ (Integer division) |
| % | Modulus (Remainder) | $a \% b$ | $1$ |
These operators act on a single operand. They are frequently used in loops, which you will cover later in the curriculum.
Increment (++): Increases the value of a variable by 1.
Decrement (--): Decreases the value of a variable by 1.
Note on Division: In C, if you divide two integers (e.g., $5 / 2$), the result will be an integer ($2$), not a decimal ($2.5$). To get a decimal result, at least one operand must be a float or double.
The modulus operator is unique because it returns the remainder of a division. It is incredibly useful in programming for tasks like:
Checking if a number is even or odd (x % 2 == 0).
Finding the last digit of a number (x % 10).
Keeping a value within a certain range (used often in circular buffers in embedded systems).
When multiple operators appear in one expression (e.g., $10 + 5 * 2$), C follows a specific order:
Multiplication, Division, and Modulus have higher priority.
Addition and Subtraction have lower priority.
If operators have the same priority, they are evaluated from left to right.
Copyright ©2025. All Rights Reserved Emblab THE RAVE INNOVATION