Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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;

image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Access Patterns Database Interactions In Object Oriented Applications

Authors: Clifton Nock

1st Edition

0321555627, 978-0321555625

More Books

Students also viewed these Databases questions

Question

How do Dimensional Database Models differ from Relational Models?

Answered: 1 week ago

Question

What type of processing do Relational Databases support?

Answered: 1 week ago

Question

Describe several aggregation operators.

Answered: 1 week ago