当前位置 博文首页 > t {aka long unsigned int}_lyndon:uint64
/* 类型长度 */
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
int main(int argc, char *argv[])
{
uint64_t a = 5;
printf("a = %d\n", a);
return EXIT_SUCCESS;
}
使用 %d
来打印 uint64_t
,编译时提示警告:
liyongjun@Box20:~/project/c/study$ make t=others/type_size
gcc others/type_size.c -o others/type_size.out -Wall
others/type_size.c: In function ‘main’:
others/type_size.c:20:18: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘uint64_t’ {aka ‘long unsigned int’} [-Wformat=]
20 | printf("a = %d\n", a);
| ~^ ~
| | |
| int uint64_t {aka long unsigned int}
| %ld
uint64_t {aka long unsigned int}
这句话一直没理解,昨天查了一下,
AKA,是一个网络流行词,是 “Also Known As” 的缩写,意思是又名、亦称、也被称为。当某人或某事有广为人知的别名时,可以用 AKA 来介绍。该词在 HIP-HOP 嘻哈文化中广为流行。
哦,原来是
uint64_t {又名 long unsigned int}
的意思。
修改很简单,按照提示,将 %d
改成 %ld
。