You have WAY too much code for what you are doing. And I really mean you have soooooooo much code for so less results.
Here's an example. I haven't tested it, but this code should behave exactly like you 1000-line display() function. I cut over 900 lines.
Code:
#define MAX_SEARCH 255
void display(PlayerInfo players[MAX_PLAYERS], int noOfPlayers) {
PlayerInfo** result = new PlayerInfo*[noOfPlayers];
char search[MAX_SEARCH + 1];
int count_result = 0;
int print = 0;
printf("noOfPlayers: %d\n", noOfPlayers);
printf("How do you wish to list the player(s)?\n");
printf("Surname, Initial, Seasons, Games, Goals or Worth?");
scanf("%s", &search);
if (strcmp(search, "Seasons") == 0) {
int seasons = 0;
printf("How many seasons has the player(s) played? ");
scanf("%d", &seasons);
for (print = 0; print < noOfPlayers; print++) {
if (players[print].noSeasonsPlayed == seasons)
result[count_result++] = &players[print];
}
if (strcmp(search, "Games") == 0) {
int games = 0;
printf("How many games has the player(s) played? ");
scanf("%d", &games);
for (print = 0; print < noOfPlayers; print++)
if (players[print].noGamesPlayed == games)
result[count_result++] = &players[print];
}
if (strcmp(search, "Goals") == 0) {
int goals = 0;
printf("How many goals has the player(s) scored? ");
scanf("%d", &goals);
for (print = 0; print < noOfPlayers; print++)
if (players[print].noGoals == goals)
result[count_result++] = &players[print];
}
if (strcmp(search, "Worth") == 0) {
int worth = 0;
printf("How much is the player(s) worth? ");
scanf("%d", &worth);
for (print = 0; print < noOfPlayers; print++)
if (players[print].worth == worth)
result[count_result++] = &players[print];
}
if (strcmp(search, "Surname") == 0) {
char last;
printf("Please enter the first letter of their last name: ");
scanf("%s", &last);
for (print = 0; print < noOfPlayers; print++)
if (players[print].familyName[0] == last)
result[count_result++] = &players[print];
}
if (strcmp(search, "Initial") == 0) {
char initial;
printf("Please enter their initial: ");
scanf("%s", &inital);
for (print = 0; print < noOfPlayers; print++)
if (players[print].firstName[0] == initial)
result[count_result++] = &players[print];
}
printf("\n================================================ ================================");
printf("|| Players ||");
printf("================================================== ==============================");
printf("|| ||");
printf("||Last Inital| PlayerNo Seasons Games noGoals worth ID ||");
printf("||________________________________________________ ____________________________||");
for(int i = 0; i < count_result; i++) {
printf("||%s %s %d %d %d %d %d %d ||", result[i]->familyName, result[i]->firstName,
result[i]->playerNo, result[i]->noSeasonsPlayed, result[i]->noGamesPlayed, result[i]->noGoals,
result[i]->worth, result[i]->ID);
printf("||________________________________________________ ____________________________||\n");
}
}
There is still a lot of place for improvement but I'm quite tired now.