typedef signed char int8_t;
typedef short int int16_t;
typedef int int32_t;
typedef unsigned char uint8_t;
typedef unsigned short int uint16_t;
typedef unsigned int uint32_t;
名稱 | 字節(jié)長度 | 取值范圍 |
---|---|---|
bool | 1 | false,true |
char | 1 | -128~127 |
signed char | 1 | -128~127 |
unsigned char | 1 | 0~255 |
short(signed short) | 2 | -215 ~ 215 - 1 |
unsigned short | 2 | 0~216-1 |
int (signed int) | 4 | -231 ~ 231-1 |
unsigned int | 4 | 0~232-1 |
long (signed long) | 4 | -231 ~ 231-1 |
long long | 8 | -263 ~ 263-1 |
unsigned long | 4 | 0~232-1 |
float | 4 | -3.4* 10-38~ 3.4*1038 |
double | 8 | -1.710-308 ~ 1.710-308 |
注意,uint8_t實(shí)際上就是一個(gè)char权纤,所以輸出 uint8_t類型的變量實(shí)際上輸出對(duì)應(yīng)的字符筑煮,而不是數(shù)值都毒,比如:
uint8_t num=67;
cout << num << endl; //輸出結(jié)果為C
reference
https://blog.csdn.net/qq_19784349/article/details/82927169