# Questions tagged [absolute-difference]

1 questions

**5**

votes

**4**answers

### How could I safely find the absolute difference between 2 signed integers in C?

An absolute difference would be the absolute value of the difference between 2 numbers. Suppose I have 2 int variables (x and y) and I would like to find the absolute difference. An easy solution would be:
unsigned diff = abs(x-y);
However theseā¦

user16217248

- 3,119
- 19
- 19
- 37