Topics: Recursive Structs, Pointers and Memory Management in C.
For this assignment, you will write a multi-file C program to define, implement and use a dynamic linked lists. Please refer to Lab 04 for the definition of a basic linked list.
In this assignment you will need to use the basic ideas of a node and of a linked list of nodes to implement a suit of functions which can be used to create and maintain two specific kinds of lists (of node s) - as well as other hybrid lists:
- A list where all adds and removes occur at the start of the list (a Stack)
- A list where all adds occur at the end of the list, and removes the start of the list (a Queue)
Requirements:
- You must write lists.c - given the following lists.h (which can not be modified):
// a recursive data type definition
// serves as the nodes of a list
typedef struct node
{
int id;
char* name;
struct node* next;
} node;
// a new list is created by: node* head = NULL;
// add a new node to the front of the list
void add_front(node* *head, node* new_node);
// add a new node to the end of the list
void add_end(node* *head, node* new_node);
// remove and return the node at the front of the list or NULL if empty
node* rem_front(node* *head);
// remove and return the node at the end of the list or NULL if empty
node* rem_end(node* *head);
// return the number of nodes in the list
int list_len(const node* head);
// print the data values of all the nodes in the list (from start to end)
void print_list(const node* head);
// free the entire list and set *head = NULL
void free_list(node* *head);
- You must write main.c which tests your list implementations completely
- You must write an appropriate Makefile
Topics: Recursive Structs, Pointers and Memory Management in C. For this assignment, you will write a multi-file C program to define, implement and use a dynamic linked lists. Please refer to Lab 04 for the definition of a basic linked list. In this assignment you will need to use the basic ideas of a node and of a linked list of nodes to implement a suit of functions which can be used to create and maintain two specific kinds of lists of node s) - as well as other hybrid lists: 1. A list where all adds and removes occur at the start of the list (a Stack) 2. A list where all adds occur at the end of the list and removes the start of the list (a Queue) Requirements: You must write lists. 6 - given the following lists. / (which can not be modified): // a recursive data type definition // serves as the nodes of a list typedef struct node int id; char* name; struct node* next; } node; // a new list is created by: node* head = NULL; // add a new node to the front of the list void add frent node* *head, node* newnede); // add a new node to the end of the list void add end node* *head, node* newnese); // remove and return the node at the front of the list or NULL if empty node* sem Front Anode* *head); // remove and return the node at the end of the list or NULL if empty node* nemend node* *head); 1/ return the number of nodes in the list int distaden const node* head); 1/ print the data values of all the nodes in the list (from start to end) void Bringendist.const node* head); // free the entire list and set *head = NULL void fresadist node* *head); You must write mains which tests your list implementations completely You must write an appropriate Makefile Topics: Recursive Structs, Pointers and Memory Management in C. For this assignment, you will write a multi-file C program to define, implement and use a dynamic linked lists. Please refer to Lab 04 for the definition of a basic linked list. In this assignment you will need to use the basic ideas of a node and of a linked list of nodes to implement a suit of functions which can be used to create and maintain two specific kinds of lists of node s) - as well as other hybrid lists: 1. A list where all adds and removes occur at the start of the list (a Stack) 2. A list where all adds occur at the end of the list and removes the start of the list (a Queue) Requirements: You must write lists. 6 - given the following lists. / (which can not be modified): // a recursive data type definition // serves as the nodes of a list typedef struct node int id; char* name; struct node* next; } node; // a new list is created by: node* head = NULL; // add a new node to the front of the list void add frent node* *head, node* newnede); // add a new node to the end of the list void add end node* *head, node* newnese); // remove and return the node at the front of the list or NULL if empty node* sem Front Anode* *head); // remove and return the node at the end of the list or NULL if empty node* nemend node* *head); 1/ return the number of nodes in the list int distaden const node* head); 1/ print the data values of all the nodes in the list (from start to end) void Bringendist.const node* head); // free the entire list and set *head = NULL void fresadist node* *head); You must write mains which tests your list implementations completely You must write an appropriate Makefile