C 冲突类型,当它们都为空时
我的代码出现以下错误,其中一个我找不到修复的方法。我理解函数类型的声明必须与定义匹配,但它确实匹配C 冲突类型,当它们都为空时,c,C,我的代码出现以下错误,其中一个我找不到修复的方法。我理解函数类型的声明必须与定义匹配,但它确实匹配 #include <stdio.h> #include <math.h> //Global Declarations int input_win(void); int input_scores(int,int); void results(int,int,int,int); int main() { //Local Declarations int winN
#include <stdio.h>
#include <math.h>
//Global Declarations
int input_win(void);
int input_scores(int,int);
void results(int,int,int,int);
int main()
{
//Local Declarations
int winNum; //The number of points needed to win
int scores[25]; //The array of scores
int score_old = 0; //The second to most recent score input
int score_new; //The most recent score input
int cnt_score = 1; //The count for input
int cnt_won = 0; //The count for games won
int cnt_played =0; //The count for games played
//Executeable Statements
winNum = input_win();
do
{
score_new = input_scores(cnt_score,cnt_won);
if(score_new != -1)
{
if(score_new <= score_old)
{
cnt_played += 1;
}
if(score_new == winNum)
{
cnt_won += 1;
}
scores[cnt_score - 1] = score_new;
score_old = score_new;
cnt_score += 1;
}
}while(score_new != -1 || score_new != 25);
results(cnt_score,scores,cnt_won,cnt_played);
return 0;
}
您的函数原型与您的函数定义不匹配:
void results(int,int,int,int);
void results(int cnt_score,int scores[25],int cnt_won,int cnt_played) { ... }
请注意,第二个参数是
int*
,而不是int
您的函数原型与您的函数定义不匹配:
void results(int,int,int,int);
void results(int cnt_score,int scores[25],int cnt_won,int cnt_played) { ... }
请注意,第二个参数是
int*
,而不是int
您的函数原型与您的函数定义不匹配:
void results(int,int,int,int);
void results(int cnt_score,int scores[25],int cnt_won,int cnt_played) { ... }
请注意,第二个参数是
int*
,而不是int
您的函数原型与您的函数定义不匹配:
void results(int,int,int,int);
void results(int cnt_score,int scores[25],int cnt_won,int cnt_played) { ... }
请注意,第二个参数是
int*
,而不是int函数的第二个参数是用int
类型声明的,但您的实现是用int[25]
类型声明的,这是一个整数数组。函数的第二个参数是用int
类型声明的,但是您的实现是类型int[25]
,一个整数数组。函数的第二个参数是用类型int
声明的,但是您的实现是类型int[25]
,一个整数数组。函数的第二个参数是用类型int
声明的,但是您的实现是int[25]
,一个整数数组。将结果函数重新声明为:
void results(int,int[],int,int);
将结果函数重新声明为:
void results(int,int[],int,int);
将结果函数重新声明为:
void results(int,int[],int,int);
将结果函数重新声明为:
void results(int,int[],int,int);
第二个参数的类型不是真的int[25]
?@EsaLakaniemi:关于这一点有很多帖子:我遇到错误的所有帖子似乎都是人们忘记声明他们的函数,因此它被默认为int。或者声明为int,然后将其称为char或其他东西。找不到返回此错误的参数不匹配的问题。顺便说一句,再次感谢您的帮助。第二个参数的类型不是真的int[25]
?@EsaLakaniemi:关于这个问题有很多帖子:我遇到的所有错误都是人们忘记声明他们的函数,因此,它被默认为int。或者将其声明为int,然后将其称为char或其他东西。找不到返回此错误的参数不匹配的问题。顺便说一句,再次感谢您的帮助。第二个参数的类型不是真的int[25]
?@EsaLakaniemi:关于这个问题有很多帖子:我遇到的所有错误都是人们忘记声明他们的函数,因此,它被默认为int。或者将其声明为int,然后将其称为char或其他东西。找不到返回此错误的参数不匹配的问题。顺便说一句,再次感谢您的帮助。第二个参数的类型不是真的int[25]
?@EsaLakaniemi:关于这个问题有很多帖子:我遇到的所有错误都是人们忘记声明他们的函数,因此,它被默认为int。或者将其声明为int,然后将其称为char或其他东西。找不到返回此错误的参数不匹配的问题。顺便说一句,再次感谢你的帮助。谢谢你在那里的帮助。。。现在,如果我能找出为什么我的do while循环在分数为-1时没有结束…你的条件应该使用&&而不是| |。在我刷新时捕捉到了这一点,非常感谢大家!!代码现在运行得很好。谢谢你的帮助。。。现在,如果我能找出为什么我的do while循环在分数为-1时没有结束…你的条件应该使用&&而不是| |。在我刷新时捕捉到了这一点,非常感谢大家!!代码现在运行得很好。谢谢你的帮助。。。现在,如果我能找出为什么我的do while循环在分数为-1时没有结束…你的条件应该使用&&而不是| |。在我刷新时捕捉到了这一点,非常感谢大家!!代码现在运行得很好。谢谢你的帮助。。。现在,如果我能找出为什么我的do while循环在分数为-1时没有结束…你的条件应该使用&&而不是| |。在我刷新时捕捉到了这一点,非常感谢大家!!代码现在运行得非常好。