十六进制格式的无符号long long类型的印刷 [英] unsigned long long type printing in hexadecimal format
本文介绍了十六进制格式的无符号long long类型的印刷的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图打印出无符号长长
是这样的:
I am trying to print out an unsigned long long
like this:
printf("Hex add is: 0x%ux ", hexAdd);
但我正在逐渐类型转换错误,因为我有一个无符号长长
。
推荐答案
您可以使用相同的 LL
尺寸修改为%X
,这样的:
You can use the same ll
size modifier for %x
, thus:
#include <stdio.h>
int main() {
unsigned long long x = 123456789012345ULL;
printf("%llx\n", x);
return 0;
}
转换和格式说明符的满量程是一个伟大的表在这里:
The full range of conversion and formatting specifiers is in a great table here:
printf
documentation on cppeference.com
这篇关于十六进制格式的无符号long long类型的印刷的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文