Yea I know my code is huge, but I'm not worrying about that right now....just trying to get things 2 work, will deal with it later. But, I have got it to save to the same file....but now in my team struct, I have an array of numbers which correspond to the ID numbers of the players in the team. I am wondering how to print those numbers stored in the array, so they can be used for when a player scores a goal and has their goal count increased, their worth increased etc...
Code:
void displayTeamPlayers(TeamInfo teams[MAX_TEAMS], int noOfTeams) {
int print = 0;
int test;
char teamNameIn[STRING_LENGTH];
printf("Please enter the team: ");
scanf("%s", teamNameIn);
for (print = 0; print < noOfTeams; print++) {
if (strcmp(teams[print].teamName,teamNameIn)==0) {
ID1 = teams[print].player_array[0];
ID2 = teams[print].player_array[1];
ID3 = teams[print].player_array[2];
ID4 = teams[print].player_array[3];
ID5 = teams[print].player_array[4];
ID6 = teams[print].player_array[5];
ID7 = teams[print].player_array[6];
ID8 = teams[print].player_array[7];
ID9 = teams[print].player_array[8];
ID10 = teams[print].player_array[9];
ID11 = teams[print].player_array[10]; /*why can't I do this?*/
printf("Team players \n");
printf("==================================================\n");
printf("||Player1ID: %d \n", teams[print].player_array[0]);
//printf("%d\n", ID1);
printf("||Player2ID: %d \n", teams[print].player_array[1]);
//printf("%d\n", ID2);
printf("||Player3ID: %d \n", teams[print].player_array[2]);
//printf("%d\n", ID3);
printf("||Player4ID: %d \n", teams[print].player_array[3]);
//printf("%d\n", ID4);
printf("||Player5ID: %d \n", teams[print].player_array[4]);
//printf("%d\n", ID5);
printf("||Player6ID: %d \n", teams[print].player_array[5]);
//printf("%d\n", ID6);
printf("||Player7ID: %d \n", teams[print].player_array[6]);
//printf("%d\n", ID7);
printf("||Player8ID: %d \n", teams[print].player_array[7]);
//printf("%d\n", ID8);
printf("||Player9ID: %d \n", teams[print].player_array[8]);
//printf("%d\n", ID9);
printf("||Player10ID: %d \n", teams[print].player_array[9]);
//printf("%d\n", ID10);
printf("||Player11ID: %d \n", teams[print].player_array[10]);
//printf("%d\n", ID11);
printf("||________________________________________________\n");
}
}
}
any ideas? Do I have to use pointers?
Cheers,
Submeg.