【发布时间】:2019-08-05 10:34:27
【问题描述】:
我有考试。我有排行榜。正如您在 struct 中看到的那样,有团队名称、简称、积分等。我必须使用函数来编写一个 txt 文件,但我不能将函数与数组结构一起使用。我的代码在下面。当我使用这样的功能时,代码块给了我错误。我该如何使用?
(我找到了答案。如果你也需要的话,下面有一个链接。 http://kursattopcuoglu.blogspot.com/2010/06/ilk-donem-final-sorusuna-benzer-bir.html)
struct teams{
char shortname;
char teamname;
int points;
};
void table(struct teams);
int main{
team[2]={'A',"Fenerbahce",0},{'B',"Galatasaray",0};
....
}
void(struct teams team[2]{
printf("%d",team[0].points);
【问题讨论】:
-
你没有给你的函数一个名字...。
void (struct teams *team)缺少名称。此外,您应该编辑您的原始问题不添加答案 -
欢迎来到Stack Overflow,请阅读How to Ask 和minimal reproducible example,了解您的问题为何被否决。
-
为了帮助人们回答您的问题,您需要更具体地说明错误。请edit 您的帖子包含您从minimal reproducible example 获得的确切错误(最好使用复制+粘贴以避免转录错误)。
-
用
struct teams team[2]=...替换team[2]=..