如何在gcc中打印UINT64_t? [英] How to print UINT64_t in gcc?
本文介绍了如何在gcc中打印UINT64_t?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
#include< stdio.h>
main()
{
UINT64_t ram = 90;
printf(%d\\\
,ram);
}
我收到以下错误:
在函数\\\‘main\\\’
错误:\\\‘UINT64_t\\\’未声明(在此函数中首次使用)
错误:(每未报告的标识符仅报告一次
错误:对于它出现的每个函数。)
错误:预计\\\‘; \\\’在\\\‘ram\\\’之前
$ c $在标准整数类型中定义 头文件。即 stdint.h
。
所以首先在程序中包含 stdint.h
。然后你可以使用格式说明符 $%$ PR $ {code $> printf(%)打印您的值:即
PRIu64\\\
,ram);
您也可以参考这个问题如何在C中打印int64_t类型
Why this code is not working?
#include <stdio.h>
main()
{
UINT64_t ram = 90;
printf("%d""\n", ram);
}
I got the Following errors:
In function \u2018main\u2019
error: \u2018UINT64_t\u2019 undeclared (first use in this function)
error: (Each undeclared identifier is reported only once
error: for each function it appears in.)
error: expected \u2018;\u2019 before \u2018ram\u2019
解决方案 uint64_t
is defined in Standard Integer Type header file. ie, stdint.h
.
So first include stdint.h
in your program.
Then you can use format specifier "%"PRIu64
to print your value: i.e.
printf("%" PRIu64 "\n", ram);
You can refer this question also How to print a int64_t type in C
这篇关于如何在gcc中打印UINT64_t?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文