I read that the range of an int is dependent on a byte.
So taking int to be 4 bytes long, thats 4 * 8 bits = 32 bits.
So the range should be : 2 ^ (32-1) = 2 ^ (
You mean 232-1, NOT 232-1.
But your question is about why people use 231. The loss of a whole bit is if the int is a signed one. You lose the first bit to indicate if the number is positive or negative.
A signed int (32 bit) ranges from -2,147,483,648 to +2,147,483,647. An unsigned int (32 bit) ranges from 0 to 4,294,967,295 (which is 232 -1).