Hi! Can you explain for me? Unsigned int will have range 0 to 232 -1. Signed int will have range - 231 to 231 - 1. Why?
signed int and unsigned int
Collapse
X
-
Tags: None
-
Originally posted by Ganon11I believe unsigned ints have a range of 0 to +4,294,967,295, while signed ints have a range of −2,147,483 ,648 to +2,147,483,647.
Let me explain Ganon11.
Suppose in which environment there Integer supports X bit long.
X may be 16 or 32, it does not matter to my explanation.
For signed int(the Integer signed, may be + or -), the range is -2^(X-1) to +2^(x-1). Because here one bit is reserved for + or -.
And for unsigned int(the Integer unsigned, it is always +), the range is 0 to (2^X)-1. Here the explanation is Simple.
Kind regards,
Dmjpro.Comment
-
Comment