gpt4 book ai didi

在 C 中将 int 转换为字节数组?

转载 作者:太空狗 更新时间:2023-10-29 17:21:01 26 4
gpt4 key购买 nike

我需要将存储在 int 中的十进制数转换为字节数组(也就是存储在无符号字符数组中)。

有什么线索吗?

最佳答案

或者如果你知道自己在做什么:

int n = 12345;
char* a = (char*)&n;

关于在 C 中将 int 转换为字节数组?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3447735/

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