gpt4 book ai didi

c - 将结构指针传递给函数时出现错误 "ISO C forbids forward parameter decleration"?

转载 作者:行者123 更新时间:2023-12-01 16:19:01 24 4
gpt4 key购买 nike

我有下面的代码,结构声明在main之前,函数声明也是

struct stuff{
int sale_per_day[Kdays];
int max_sale;
};

void set_max();

最后那部分...

void set_max(struct stuff *point; int n = 0)
{
return;
}

现在我到底做错了什么?我明白了

"ISO C forbids forward parameter declaration"

错误。根据类(class)要求,我正在使用 GCC C89。

最佳答案

看起来好像只需要一个逗号而不是分号:

void set_max(struct stuff *point, int n = 0)

关于c - 将结构指针传递给函数时出现错误 "ISO C forbids forward parameter decleration"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10455576/

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