Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - What is the data range of 4 bytes in C language?
What is the data range of 4 bytes in C language?
1 byte is 8 bits and 4 bytes is 32 bits, so the range of representation is 32 zeros to 32 1.

If it is an unsigned number of unsigned type, then the minimum value is 0 and the maximum value is (2 to the 32nd power)-1;

(Why is it the 32nd power of 2-1? In terms of 1 8 digits, 000000 1 is 1, which is the 0 th power of 2; 0000 00 10 means 2, which is the power of 2 of 1, so 1000000, the highest bit is the power of 2 of 7, so1116544.

If it is a signed number, then the highest bit is the sign bit, and the other 3 1 bits are numerical bits, then the largest positive number is (3 1 to the second power)-1; Negative numbers are represented by the complement, that is, the complement+1, so 1000...00 (3 1 zeros) represents 3 1 power of -2, so the minimum number is 3 1 power of -2.

So for a long integer of 4 bytes,

The unsigned range is 0 to 2 32-1.

The signed number ranges from -2 3 1 to 2 3 1- 1.