在32位平台 typedef unsigned long long int uint64_t;
在64位平台 typedef unsigned long int uint64_t;
不同的typdef,要求在printf中使用不同的length modifier,uint64_t 在32位使用ll,在64位使用l。除了定义数据类型,C99还定义了相应数据类型的打印方式,使用PRIu64打印uint64,举例如下:
#include <stdio.h>
#define __STDC_FORMAT_MACROS //开启宏定义
#include <inttypes.h> //头文件
int main(int argc, char **argv)
{
uint64_t i = 123;
printf("%" PRId64 "\n", i);
return 0;
}