c language Implement M.A.S.H. Game Database (main.c) Use an array of DataNode pointers to store the game data, with an ENUM for the indexes as follows: database[HOME_LIST] ---->>>>> DataNode* listHead for list of homes database[FEMALE_SPOUSE_LIST] ---->>>>> DataNode* listHead for list of female spouses database[MALE_SPOUSE_LIST] ---->>>>> DataNode* listHead for list of male spouses database[OCCUPATION_LIST] ---->>>>> DataNode* listHead for list of occupations database[TRANSPORTATION_LIST] ---->>>>> DataNode* listHead for list of transportion - - methods database[HOMETOWN_LIST] ---->>>>> DataNode* listHead for list of hometowns The data values should be specified in an char array of strings by using an initializer list. This array will be passed to the BuildDataList function as a parameter which will in turn construct the list, allocating memory as requi
Types of Linked List
A sequence of data elements connected through links is called a linked list (LL). The elements of a linked list are nodes containing data and a reference to the next node in the list. In a linked list, the elements are stored in a non-contiguous manner and the linear order in maintained by means of a pointer associated with each node in the list which is used to point to the subsequent node in the list.
Linked List
When a set of items is organized sequentially, it is termed as list. Linked list is a list whose order is given by links from one item to the next. It contains a link to the structure containing the next item so we can say that it is a completely different way to represent a list. In linked list, each structure of the list is known as node and it consists of two fields (one for containing the item and other one is for containing the next item address).
Using c language
Implement M.A.S.H. Game
Use an array of DataNode pointers to store the game data, with an ENUM for the indexes as follows:
- database[HOME_LIST] ---->>>>> DataNode* listHead for list of homes
- database[FEMALE_SPOUSE_LIST] ---->>>>> DataNode* listHead for list of female spouses
- database[MALE_SPOUSE_LIST] ---->>>>> DataNode* listHead for list of male spouses
- database[OCCUPATION_LIST] ---->>>>> DataNode* listHead for list of occupations
- database[TRANSPORTATION_LIST] ---->>>>> DataNode* listHead for list of transportion - - methods
- database[HOMETOWN_LIST] ---->>>>> DataNode* listHead for list of hometowns
The data values should be specified in an char array of strings by using an initializer list. This array will be passed to the BuildDataList function as a parameter which will in turn construct the list, allocating memory as required, and return a pointer to the listHead. This pointer should be stored at the cooresponding index in the database.
NOTE: Each list should contain a minimum of 5 options.
4. Display M.A.S.H. Game Database (main.c)
Display the contents of the M.A.S.H. Game Database by calling the PrintDataList function on each list in the database array.
--------------------- Future Possibilities Database ------------------------ Home List: mansion, apartment, shack, house Female Spouse List: Robin, Lily, Nora, Patrice, Zoey, Quinn Male Spouse List: Ted, Marshall, Barney, Ranjit, Carl, Linus Occupation List: teacher, architect, lawyer, newscaster, undercover agent Transportation List: walk, ride the train, ride a bus, fly an airplane, carpool Hometown List: Cleveland, Queens, The Bronx, Brooklyn, Manhattan, Staten Island ----------------------------------------------------------------------------
Trending now
This is a popular solution!
Step by step
Solved in 2 steps