why the range of int is -2^31 to 2^31-1 not -2^31-1 to 2^31-1
Regarding range of data type
We have 32 bits for int which means we can store at most 4294967296 ( 2^32 ) values in it … So dividing it for two sides …+ve and -ve gives us 2147483648 for each … But since 0 is also there which is counted in neither of the sides … We reduce one from the positive side to accommodate zero … So the range of int becomes
-2147483648 to 2147483647 … Or simply -2^31 to 2^31 -1