Question: C linked list have 2 structs. a passenger struct and a node struct. passenger struct will have : A unique passenger ID (integer) Passenger First
C linked list
have 2 structs.
a passenger struct and a node struct.
passenger struct will have :
A unique passenger ID (integer)
Passenger First Name (char string of 25 characters)
Passenger Last Name (char string of 35 characters)
Current balance of passenger shipboard account (double) =0;
Passenger Location (char) = 0;
node struct:
tpedef struct node
{
struct passenger * passenger;
struct node *next;
}node;
1)Create two linked list head nodes in your main() function, one for the onShip list and one for the offShip list.
2)Write a function that creates a Linked List node. This function will have no parameters. It will use memory allocation to create a Linked List node, prompt for all information required for a passenger struct, initialize the Passenger struct portion of the Linked List node with this information,set the Next pointer to NULL, and return a pointer to this newly created node.
3)Create a function that takes a pointer to a Linked List node as a parameter and returns the Passenger ID.
4)Create a Linked List function that will return a pointer to a node in a linked list, without removing that node. This function takes the head of a linked list and an integer value (the Passenger ID) as parameters. If the node containing the Passenger ID is not found in the linked list, a void pointer is returned.
5)Create a Linked List function that will add a node to a linked list. This function takes the head of a linked list and a pointer to the node to add as parameters. The function will use the function created in Step F to determine where the node will be added.
6)Create a Linked List function that will remove a node from a linked list, and return a pointer to the removed node. This function takes the head of a linked list and an integer value (the Passenger ID) as parameters. If the node containing the Passenger ID is not found in the linked list, a void pointer is returned.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
