int8_t、uint8_t等来源

在开发过程中,经常会使用到int8_t、uint8_t、int16_t、uint16_t等声明变量,尤其是结构体中作为变量类型,以达到更直观显示所占内存的目的。但我们编码直接使用时,有时发现并没有该类型存在,那么它们的真正来源是何处呢?主要来自两个途径。

一、 自定义

  使用常用数据类型自定义如下:

  typedef char int8_t;
  typedef unsigned char uint8_t;
  typedef short int16_t;
  typedef unsigned short uint16_t;
  typedef int int32_t;
  typedef unsigned int uint32_t;
  typedef __int64 int64_t;
  typedef unsigned __int64 uint64_t;

 

二、 调用库文件

        #include <stdint.h>

posted @ 2018-03-30 11:10  huhuahope  阅读(602)  评论(0编辑  收藏  举报