Lab Sheet 12
Lab Sheet 12
)
CS F111 Computer Programming
LAB SESSION #12
(Linked Lists)
Q1. Create a linked list to store floating-point values. Use pointers and dynamic memory
allocation. Implement the following functions:
Follow the implementation explained in the slides for each of the above functions. For each
function, use a similar set of function parameters and return type as explained in the
slides. Also, follow the same way as the main() function calls these functions. If some function
is not implemented on the slides, you can appropriately decide the function parameters for it
and complete its implementation.
Create multiple header (.h) and source (.c) files to keep the program modular. Have all the
global variables and function declarations in linkedList.h. The implementations of all the
functions can be in linkedList.c. The main function can be in main.c where you can create a
linked list, append nodes to it, remove nodes from it, etc. using appropriate function calls that
are defined in linkedList.c. Follow the main function implementation as explained in the slides.
Also, give a script file to compile, link and execute the project.
Q2. Instead of storing float values in the linked list, you should now store student records
containing the attributes: ID (char array), Name (char array), Dept (char array), math_marks
(integer), phy_marks (integer), chem_marks (integer). Then implement the following functions
with specifications as follows:
Create multiple header (.h) and source (.c) files to keep the program modular. Have all the
global variables and function declarations in linkedList_Student.h. The implementations of
all the functions can be in linkedList_Student.c. The main function can be in
main_StudentList.c where you can create a linked list, append nodes to it, remove nodes
from it using appropriate function calls that are defined in linkedList_Student.c. Also give a
script file to compile, link and execute the project.