If I was trying to pass the struct "stats" to the function sortStats, I need a parameter type. I tried struct but it doesn't like that as it seems to think I'm trying to create a new struct or something.
Code:int sortStats(int numPlayers, ?? stats)
This is where I'm at now...Code:typedef struct
{
int ind;
char player[25];
char team[4];
char pos[2];
int gamesPlayed;
int goals;
int assists;
int points;
int plusMinus;
int penaltyMins;
int ppGoals;
int shGoals;
int gwGoals;
int otGoals;
int shots;
float shotPercent;
char timeOnIce[6];
float shiftsPerGame;
float faceOffWinPercent;
} stats;
int sortStats(int numPlayers, stats)
{
int mostGoals = 0;
int mostGoalsInd = 0;
int i = 0;
for (i=0;i<numPlayers;i++)
{
if (myPlayers[i].goals > mostGoals)
{
mostGoals = myPlayers[i].goals;
mostGoalsInd = myPlayers[i].ind;
}
}
//printf("%s scored the most goals this season with %d.\n", myPlayers[mostGoalsInd], mostGoals);
return 0;
}
int main(int argc, char *argv[])
{
int ind, gamesPlayed, goals, assists, points, plusMinus, penaltyMins, ppGoals, shGoals, gwGoals, otGoals, shots;
float shotPercent, shiftsPerGame, faceOffWinPercent;
char player[50];
char team[4];
char pos[2];
char timeOnIce[10];
int strPlayer = 0;
int strTimeOnIce = 0;
int numPlayers;
char myStr[] = "nhl0708.txt";
char myPlayers[1000];
numPlayers = getNumPlayers(myStr);
getLength(numPlayers, myStr);
loadData(numPlayers, myStr);
sortStats(numPlayers, stats);
system("PAUSE");
return 0;
}

