Quiz Entry - updated: 2026.07.14
How can you tell if a hexadecimal number is negative (in two's complement)?
Look at the leading hex digit: 0–7 means positive, 8–F means negative (its top bit — the sign bit — is 1).
For 32-bit integers:
0x7FFFFFFF = +2,147,483,647 (positive, starts with 7)
0x80000000 = -2,147,483,648 (negative, starts with 8)
0xFFFFFFFF = -1 (negative, starts with F)
0x00000001 = +1 (positive, starts with 0)
Why 8-F means negative:
- Hex digit 8 = binary
1000 - The leading 1 is the sign bit
- Hex digits 0-7 start with binary
0xxx(positive) - Hex digits 8-F start with binary
1xxx(negative)
Quick reference:
| First Hex Digit | Binary Start | Sign |
|---|---|---|
| 0-7 | 0... | Positive |
| 8-F | 1... | Negative |
Common values to recognize:
0xFFFFFFFF= -10xFFFFFFFE= -20x80000000= INT_MIN (most negative)0x7FFFFFFF= INT_MAX (most positive)
Tip: When debugging, seeing 0xFFFF... usually means -1 or an error code, not a huge positive number!