In the range of C language int, long, storage space, and a long long value

When new to the range of storage space and integer data values, I feel this thing is boring, it should be no use of it! But, now, have to admit, this thing is really useful. When programming, sometimes we need to consider the size of the data, this time will be able to deeply appreciate the use of the following table. For example, some participated in Programming Contest friends should know that the title is the size of the required test data.

Types of Byte count Ranges
int 2 --32 768 to 32767 (decimal 5)
int 4 --2,147,483,648 2147483647 (decimal 10)
unsignde int 2 0 to 65535 (decimal 5)
unsignde int 4 0 to 4,294,967,295 (10 decimal)
short 2 --32 768 to 32767 (decimal 5)
unsigned short 2 0 to 65535 (decimal 5)
long 4 --2,147,483,648 2147483647 (decimal 10)
usigned long 4 0 to 4,294,967,295 (10 decimal)
long long 8 - ~ 9223372036854775808 9223372036854775807 (20 decimal)
unsigned long long 8 18446744073709551615 0 (decimal 20)

Explanation:

1, the memory system to compile int type data distribution may be 2 bytes or 4 bytes, the system compiler's discretion. For example: Turbo C 2.0 is assigned 2 bytes, and Visual C ++ allocating 4 bytes.

2, considering the data size at the time of programming, if not remember the specific numerical ranges, it may be determined according to what type of decimal places. For example: when the size necessary to store a number 0,000,000 100 may be selected greater than or equal to 10 in decimal number range type, as long, long long like.

Guess you like

Origin www.cnblogs.com/godfriend/p/10931503.html