How an unsigned int can be twice as large as the singed int?

1 answer

Answer

1141156

2026-08-20 11:56

+ Follow

If you have a 1 byte (8 bit) number, then you can use those bits in two different ways, signed and unsigned.

Unsigned means that all 8 bits represent a power of two, so you can go from 00000000 = 0 (2^0) to 11111111 = 255 (2^8 - 1).

SIgned means that you take the first bit and use it to represent positive or negative. In this case 00000001 = 1 and 10000001 = -1. So your range of values is 11111111 = -127 (-(2^7 - 1)) to 01111111 = 127.

There are a couple of problems with this simplified example, one being that you have two different representations for zero. Most computer systems use two's complement to get around this.

ReportLike(0ShareFavorite

Copyright © 2026 eLLeNow.com All Rights Reserved.