inttypes.h

_t可以理解为对结构的标注

1
2
3
4
5
6
7
8
typedef unsigned char uint8_t;
typedef signed char int8_t; //有符号8位数
typedef unsigned int uint16_t; //无符号16位数
typedef signed int int16_t; //有符号16位数
typedef unsigned long uint32_t; //无符号32位数
typedef signed long int32_t; //有符号32位数
typedef float float32; //单精度浮点数
typedef double float64; //双精度浮点数

一般来说整形对应的*_t类型为:

  • uint8_t为1字节
  • uint16_t为2字节
  • uint32_t为4字节
  • uint64_t为8字节