gpt4 book ai didi

c - c中int64的十进制到十六进制

转载 作者:太空狗 更新时间:2023-10-29 15:51:16 25 4
gpt4 key购买 nike

为什么这段代码不起作用?

#include <iostream>
#include <cstdio>
int main() {
printf("%X", 1327644190303473294);
}

我得到 o/p 5f264e8e

但预期的 o/p 是 126cbd5b5f264e8e,如下面的 php 脚本所示

<?php
echo dechex(1327644190303473294);
?>

最佳答案

format '%X' expects type 'unsigned int', but argument 2 has type 'long int'

#include <stdio.h>

int main(void) {
printf("%lX",1327644190303473294);
return 0;
}

输出

126CBD5B5F264E8E

关于c - c中int64的十进制到十六进制,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7240391/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com