Question: Qn2. // structure definition typedef struct game data char user_name[20]; int game id; int score; Igame data; typedef struct game array int size; game data

 Qn2. // structure definition typedef struct game data char user_name[20]; int

Qn2. // structure definition typedef struct game data char user_name[20]; int game id; int score; Igame data; typedef struct game array int size; game data 'sample game array In main function prompt the user to enter different choices, 1 to enter the game details, 2 to print all the game details, 3 to print the score of a particular gamer, 4 to print all game details in reverse order, 5 to exit the program. When the user enters option 1: call a function named add_game_ data passing the address of the game. The add_game_data function calls realloc() to extend the memory allocation and adds new element into the array int main() game-array game {0, NULL); = When the user enters option 2: call a function named print_game_data passing single structure (use a for loop in main to loop through the array) print_game_data function prints the details of a single structure element. When the user enters option 3: call a function named print gamer_data passing the address of the game and a string to search for in the game array. print_gamer_data function returns the score of the gamer if found otherwise returns-1. If the score is returned printout the score in main or print "No such gamer exist

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!