/* exact-width signed integer types */
typedef signed char int8_t; // 范围 -128~127 (1 Byte)
typedef signed short int int16_t; // 范围 -32768 ~ + 32767 (2 Bytes)
typedef signed int int32_t; // 范围 -32768 ~ + 32767 (4 Bytes)
typedef signed __INT64 int64_t; // 范围 -9223372036854775808 ~ +9223372036854775807 (8 Bytes)
/* exact-width unsigned integer types */
typedef unsigned char uint8_t; // 范围0~255 (1 Byte)
typedef unsigned short int uint16_t; // 范围0~65536 (2 Bytes)
typedef unsigned int uint32_t; // 范围0~4294967295 (4 Bytes)
typedef unsigned __INT64 uint64_t; // 范围0~18446744073709551615 (8 Byte)
char占用1个字节
short int占用2字节
int占用4字节
long占用4字节
long int占用4字节
float占用4字节
double占用8字节
(1)unsigned char的取值范围:0~2^8-1(0~255)
(2)char的取值范围:-2^7~2^7-1(-128~127)
速查表:
char -128 ~ +127 (1 Byte)
short -32768 ~ + 32767 (2 Bytes)
unsigned short 0 ~ 65536 (2 Bytes)
int -2147483648 ~ +2147483647 (4 Bytes)
unsigned int 0 ~ 4294967295 (4 Bytes)
long == int
long long -9223372036854775808 ~ +9223372036854775807 (8 Bytes)
double 1.7 * 10^308 (8 Bytes)
unsigned int 0 ~ 4294967295
long long的最大值:9223372036854775807
long long的最小值:-9223372036854775808
unsigned long long的最大值:18446744073709551615
__int64的最大值:9223372036854775807
__int64的最小值:-9223372036854775808
unsigned __int64的最大值:18446744073709551615
参考:https://blog.csdn.net/smile_zhangw/article/details/79063559