✅ Перевірена відповідь на це питання доступна нижче. Наші рішення, перевірені спільнотою, допомагають краще зрозуміти матеріал.
Doubly Linked List
In this exercise you will implement a generic doubly linked list in C.
Each node in the list contains a pointer to a payload (of type void *), a pointer to the next node, and a pointer to the previous node.
The list itself keeps track of its head, its tail, and the number of elements currently stored.
You should write your code in multiple files:
You’ll have to implement the below functions (Note that the LinkedList is Dynamically allocated):
To demonstrate how LL_Display can be used, you will provide two printing functions that match the required function pointer type (printInt and printString). These functions can be passed to LL_Display depending on the type of data stored in the list.
Compile the code on a Linux VM. Show screenshots of the compilation process and run the application (if you weren't able to paste thes screenshots here, send the to our TA Mr Joseph Samara (jfs22)).
The payloads that will be stored in the linked list are taken as command line arguments. The second command line argument represents the type of data that will be stored in the linked list (either int or string).
Note that in case of int, the command line arguments must be converted to integers (possibly using the atoi function).
Examples of running the application
./app int 33 45 21 89 100 2
./app string hi hello cmps241 systems programming
All memory you allocate must be freed.