I am getting the following errors with my code, one of which I cant find a way to fix. I understand the declaration of a function type must match definition, but it does.
#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 cnt_score,int scores[25],int cnt_won,int cnt_played)
{
//Local Declarations
int cnt_loop; //The counter for the for loop
//Executeable Statements
printf("\nScores entered (%d): {",cnt_score);
for (cnt_loop = 1;cnt_loop < cnt_score;cnt_loop++)
{
printf("%d, ",scores[cnt_loop - 1]);
}
printf("%d}\n",scores[cnt_score - 1]);
printf("\nNumber of games won: %d\nNumber of games played: %d\n",cnt_won,cnt_played);
}
The errors I am getting are as follows:
hw06.c: In function 'main':
hw06.c:62: warning: passing argument 2 of 'results' makes integer from pointer without a cast
hw06.c:29: note: expected 'int' but argument is of type 'int *'
hw06.c: At top level:
hw06.c:160: error: conflicting types for 'results'
hw06.c:29: note: previous declaration of 'results' was here