在C语言中有6种基本数据类型:short、int、long、float、double、char
typedef用来定义关键字或标识符的别名
uint8_t\uint_16_t\uint32_t\uint64_t 这些数据类型中都带有_t, _t 表示这些数据类型是通过typedef定义的
在C99标准中定义了这些数据类型,具体定义在:/usr/include/stdint.hISO C99: 7.18 Integer types
#ifndef __int8_t_defined
# define __int8_t_defined
typedef signed char int8_t;
typedef short int int16_t;
typedef int int32_t;
# if __WORDSIZE == 64
typedef long int int64_t;
# else
__extension__
typedef long long int int64_t;
# endif
#endif
typedef unsigned char uint8_t;
typedef unsigned short int uint16_t;
#ifndef __uint32_t_defined
typedef unsigned int uint32_t;
# define __uint32_t_defined
#endif
#if __WORDSIZE == 64
typedef unsigned long int uint64_t;
#else
__extension__
typedef unsigned long long int uint64_t;
#endif
uint16_t %hu
uint32_t %u
uint64_t %llu
typedef unsigned char uint8_t;
uint8_t num = 67;
cout << num << endl; // 结果是C
uint8_t实际上是一个char。所以输出uint8_t类型的变量实际上输出其对应的字符,而不是数值。
uint8_t / uint16_t / uint32_t /uint64_t解释
原文:https://www.cnblogs.com/lodger47/p/15217393.html