gpt4 book ai didi

c - 警告 : unused variable

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

看我写的一段代码

void my_function()
{
INT32 i; /* Variable for iteration */
/* If system is little-endian, store bytes in array as reverse order */
#ifdef LITTLE
{
// i m using i for operating one loop
}
#endif

/* If the system is big-endian, store bytes in array as forward order */
#ifdef BIG
{
// using i for loop
}
#endif
return;
}

通过使用它显示的 -Wall 标志编译这段代码

 warning: unused variable ‘i’      

为什么?我怎样才能删除它?

最佳答案

放上i的声明就在{}里面你实际使用它的地方。如果你有 C99 就更好了,在 for(int i = 0, i < bound; ++i) 中声明循环变量

关于c - 警告 : unused variable,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7093663/

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