# Operators — C Programming

Source: https://www.geekswithgeeks.com/en/c/c-operators

> Combine values into expressions.

## Arithmetic

Integer division truncates. Cast to `double` for a real quotient.

```c
int a = 7, b = 2;
a / b;            // 3  (integer division)
a % b;            // 1  (remainder)
(double)a / b;    // 3.5
```

## Compare & combine

Comparisons `== != < > <= >=` produce `0` or `1`. Logical `&&` (and), `||` (or), `!` (not). Shortcuts: `a += 3`, `a++`.

**Quiz:** In C, what is `7 / 2`?

- [ ] 3.5
- [x] 3
- [ ] 4

*Answer:* 3. Both operands are int, so the result is integer-divided to 3.
