I was wondering about byte data type. It is 8-bit based, one bit for sign and other 7 for the number itself, therefor maximum 7 bit number is 1111111 = 127, why then byte range is -128 -> 127. How -128 is represented in memory if max possible 7-bit number is 127. Thank You.
Sorry for my English, it is not my first language.
for -128 its stored as 10000000 so the value is calculated as -128.
Do not wait to strike till the iron is hot; but make it hot by striking....
Joined: Jan 14, 2011
Manoj Kumar Jain wrote:integers are stored in 2's complement form, and most right bit represents the sign as well as value. So, If you are having value like 1111 1011 then it will be calculated as below.