#include <stdio.h>
#include <stdint.h>
#include <inttypes.h>

int main(void)
{
	uint64_t num = 9223354444668731392;
	printf("%lu\n", num);             //十进制输出
	printf("0x%"PRIx64"\n", num);     //十六进制输出
	printf("0x%016lx\n", num);        //十六进制输出
}

运行结果:

9223354444668731392
0x7ffff00000000000
0x7ffff00000000000

遇到问题

error: expected ‘)’ before ‘PRIX64’

原因:打印的内容不是64位的数字

printf("0x%"PRIx64"\n", 10);

0x%"PRIX64" :显示为大写字母
0x%"PRIx64" :显示为小写字母

相关文章:

  • 2022-12-23
  • 2022-02-04
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-09
  • 2021-12-01
  • 2021-12-01
猜你喜欢
  • 2022-12-23
  • 2021-10-20
  • 2021-06-29
  • 2022-12-23
  • 2021-11-19
  • 2022-12-23
  • 2021-12-01
相关资源
相似解决方案