Linked List And Dynamic Memory Allocation in C++


Dynamic Memory Allocation:

Dynamic memory allocation means to access memory randomly. In arrays we got series of memory locations. But the drawback of the array is that it has a fixed size. And it will take that fixed memory even if you don’t use all the locations. From here the concept of dynamic memory arises. So we get different locations in memory and than link them. We can achieve this by Linked List.

Linked List:

Linked list is a dynamic data structure. In linked list we have a structure called node. The structure has 2 parts one part is called data and other is called link. Link is used to tie new node. A linked list must have a START pointing to first node. Think of link list as a train with START as an engine of the train. So here is a linked list.
Linked List in c
So as you can see in the figure we have a structure of node. And last node has a null link in it indicating end of the list.

Here is a code how to create node in c++


in this structure we have created a node with one data member and one link.

Here is a full code of linked list its insertion and display.


Note: please make sure to copy the start of list while traversing the linked list if you perform operation on start and update it, by doing this you will lost your start of list.

For understanding structures in c  click on link

For understanding Pointers in c click on link

For more queries comment below thanks.


  1. By shahab


  2. By shahab


Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>