uint64_t UINT64_C(x) PRId64
时间:2010-11-19 来源:gltmzq
uint64_t UINT64_C(x) PRId64相关的头文件是<inttypes.h> 。
<inttypes.h> 提供的基本功能包括:
定宽整型(如uint64_t)
诸如 uintptr_t 的有用类型
常量宏(如UINT64_C(x)指定给定常量的大小和符号)
限制
格式字符串宏
1 #include <stdio.h>
2 #include <inttypes.h>
3 typedef uint64_t UINT64;
4 #define UINT64_CONST(x) UINT64_C(x)
5 int main()
6 {
7 UINT64 localvar;
8 localvar=UINT64_CONST(43000000000000000);
9 printf("%lld\n",localvar);
10 localvar+=11;
11 printf("%lld\n",localvar);
12 printf("localvar=%"PRId64"\n",localvar);
13 return 0;
14 } 执行结果: 43000000000000000
43000000000000011
localvar=43000000000000011
2 #include <inttypes.h>
3 typedef uint64_t UINT64;
4 #define UINT64_CONST(x) UINT64_C(x)
5 int main()
6 {
7 UINT64 localvar;
8 localvar=UINT64_CONST(43000000000000000);
9 printf("%lld\n",localvar);
10 localvar+=11;
11 printf("%lld\n",localvar);
12 printf("localvar=%"PRId64"\n",localvar);
13 return 0;
14 } 执行结果: 43000000000000000
43000000000000011
localvar=43000000000000011
相关阅读 更多 +