integer overflow
Integer overflow happens when a calculation produces a result too big to fit in the fixed number of bits set aside for it, so the answer is wrong. Picture an old car odometer with five dials: once it reaches 99999 miles, one more mile rolls it over to 00000. The true mileage is higher, but the display has nowhere to put the extra digit, so it silently wraps around. Computer integers behave the same way — they have a fixed width and no room to grow.
For an unsigned 8-bit value the range is 0 to 255, so 255 + 1 wraps to 0; the carry that should land in a ninth bit is simply discarded. For signed two's complement the surprise is sharper: the range is -128 to +127, so 127 + 1 wraps to -128 — adding a positive to a positive can produce a negative. The hardware detects this case (a signed overflow occurs when the carry into the top bit differs from the carry out of it) and usually sets an overflow flag, but whether anyone checks that flag is up to the program. By default in many languages the wrong, wrapped value just flows onward as if nothing happened.
This is not academic. Overflow has caused real disasters: the Ariane 5 rocket was destroyed in 1996 partly because a value overflowed when squeezed into too few bits, and the so-called Year 2038 problem comes from a signed 32-bit timestamp that overflows in January 2038. The honest, important point is that overflow is usually silent — no crash, no warning, just a quietly incorrect number — which is exactly what makes it dangerous. In some languages signed overflow is even formally undefined behaviour, meaning the compiler may assume it never happens and optimise in surprising ways.
In signed 8-bit arithmetic, 127 + 1 = -128: 0111 1111 + 0000 0001 = 1000 0000, and 1000 0000 in two's complement is -128. A positive plus a positive flipped negative — that sign flip is the signal that overflow occurred.
Signed overflow wraps 127 to -128; the result fits the bits but is mathematically wrong.
Overflow is usually silent — no error, just a quietly wrong value — and in some languages signed overflow is undefined behaviour the compiler may exploit. Real failures (Ariane 5, the Year 2038 problem) trace back to it.