gpt4 book ai didi

C 程序 - 错误 : variable set but not used

转载 作者:太空宇宙 更新时间:2023-11-04 03:26:56 25 4
gpt4 key购买 nike

我在下面的代码中一直收到错误 error: variable 'addresspic' set but not used 但我清楚地使用了它。

如果我做错了什么,有人能告诉我吗?

我知道我真的应该为 addresspic 创建一个指针,而不是转换 get_pic() 的返回值,但现在我不明白为什么会这样表示未使用该变量。

//Function declaration
uint8_t* get_pic(int *piclen)

main() {

uint8_t addresspic;
unsigned int value;

addresspic = (uint8_t)get_pic((int*)& value);
}

最佳答案

我猜消息不是很清楚,但它告诉你的是没有任何东西读取 addresspic 的值;所以你分配给它(值集)但没有任何东西取决于你设置它的值(未使用)。

关于C 程序 - 错误 : variable set but not used,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40380060/

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