about range of data type. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

about range of data type.

im confused about range of data like int range is 2,147,483,684 how we calculate that ?and why when its minus it add number at the end of number??

17th May 2022, 3:13 AM
Mouadh Bouziane
Mouadh Bouziane - avatar
1 Answer
+ 1
The range is due to an int having a 4 byte size. That's 32 bits which gives you a data range of 2^32 or 0 to 2^32-1 = 4294967295. A signed int can also express negative values. The range is divided in two. The range for a signed int is -2,147,483,648 to 2,147,483,647. The negative side is one more because 0 is counted for the positive side.
17th May 2022, 7:19 AM
Mustafa A
Mustafa A - avatar