Using this C++ program elements can be stored using dynamic memory allocation and without acquiring extra space and only using the space needed.
This C++ program stores the given elements using a linked list i.e. dynamic memory allocation with the help of the cstdlib class. Dynamic memory allocation is done with the help of the malloc function. Its main advantages are that no unnecessary memory is being wasted and they are also sometimes referred to as dynamic data structure. The working of the program is as follows:-
1. Firstly we ask the user what he/she wants to do out of inserting the elements, displaying the elements, or exit.
2. According to the users choice:-
a) If the user wants to enter the elements in the linked list-> User is asked to enter the elements that have to be inserted then accordingly memory allocation takes place and the element is being inserted.
b) If the user wants to display the elements in the linked list-> The current linked list is being displayed to the user.
c) If the user selects exit-> Then the program is being terminated and execution stops.
3. The above three points are being asked again and again until the user exits the program himself.
I hope you find this project useful and the desired zip file is being attached
Submitted by Salvader Ron Nathaniel (salvaderron)
Download packets of source code on Coders Packet