[英]Why is an extra element being added to my void** array when I use merge-sort?
[英]Compiler does not see my element being added into my array
这是代码的一部分。 我一直在尝试编译,但它一直给我这个错误。 赋值语句有问题吗?
ass1cpy.c:在函数“player_data”中:
ass1cpy.c:26:46: 警告:变量 'score' 设置但未使用 [-Wunused-but-set-variable]
double average_goals,average_shots,effIndex,score[MAX];
int
player_data(void){
char name[MAX];
int maxgames,playerId,games,minutes,goals,shots,assists,yellowCards,
redCards,checker = 0, i = 0;
double average_goals,average_shots,effIndex,score[MAX];
scanf("%d",&maxgames);
while(scanf("%d %d %d %d %d %d %d %d %s",&playerId,&games,&minutes,&goals,&shots,
&assists,&yellowCards,&redCards,name) == 9){
average_goals = goal_average(goals,games);
average_shots = shots_average(shots,goals);
effIndex = effIndex_cal(goals,assists,redCards,yellowCards,games,maxgames);
if(checker == 0){
printf("Player %d scored %d goals in %d minutes from %d games\nGoals per"
" game: %05.2f\nShots per goal: %05.2f\nEffindex: %05.2f\n",playerId,
goals,minutes,games,average_goals,average_shots,effIndex);
}
checker = 1;
score[i] = effIndex
i++;
}
return 0;
}
我该如何更改它以便它可以编译?
这不是错误。 这是一个警告。 它警告您正在分配一个变量,但从未使用过。 它向您发出警告,因为这很可能是一个问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.