2.4 Linked List Implementation in C/C++ | Creation and
Display | DSA Tutorials
Jenny's Lectures CS IT
video is for this topic is you should know the basics of link list what is link list how to represent
a link list or a singly linked list. You should know what is dynamic memory allocation and how to
use the Mellow function in c language. Plus you should have the knowledge of pointers plus
structure what is structure data type in c. language. In C language we are going to write struct
node if you do n't write def fine in C++ you can simply write this node that is fine but here I am
discussing C language fine now we have created this head node initially suppose we n't have
any node in the list so initially what head pointer will store head is going to contain word 0 or
you can say null. The syntax is what you simply write mellow and in break it you will write what
the size how much memory you want right. In C++ you can use new keyword fine to use malloc
function in C++. Malloc is going to return a pointer to the starting address of that memory block.
The data type is int so we are going to use percentage D and now C you can not directly write
here hash in this address of and data. to store that address into this new node pointer that is
pointer to node but it is going to return what void pointer to show you how to typecast this one.
Head is equal to new node so simply you can write head is. equal to. new node. Head is going
having 100 the address of the first node. going to contain zero now next thing is you have to
point this to this right so now you have. to store this address into this head. You simply write
head is equal to new new node then in this case also now head is going to contain head is
equals to new node. So simply how you can access this part this structure because this node is
having datatype structure so you can not simply except this one using arrow Prater.
We are going to store new node the new node is going to contain 300 so here we can insert
now. According to this coding we have lost the link to this node now this node is not in the so
now this you can not write so the solution of this problem is what you have to take one extra.
temp temp is equal to new node that is 200 fine when we were creating when we 're inserting
this second node fine press plus what you will write here temp is. not move this head we can we
can move this temp now right now here we can write temp of next because this node is having
two pointer this one this one. If user press 0 it means where you are not going to create another
node now we are going to print these values fine so for that what you will write after this what
Display | DSA Tutorials
Jenny's Lectures CS IT
video is for this topic is you should know the basics of link list what is link list how to represent
a link list or a singly linked list. You should know what is dynamic memory allocation and how to
use the Mellow function in c language. Plus you should have the knowledge of pointers plus
structure what is structure data type in c. language. In C language we are going to write struct
node if you do n't write def fine in C++ you can simply write this node that is fine but here I am
discussing C language fine now we have created this head node initially suppose we n't have
any node in the list so initially what head pointer will store head is going to contain word 0 or
you can say null. The syntax is what you simply write mellow and in break it you will write what
the size how much memory you want right. In C++ you can use new keyword fine to use malloc
function in C++. Malloc is going to return a pointer to the starting address of that memory block.
The data type is int so we are going to use percentage D and now C you can not directly write
here hash in this address of and data. to store that address into this new node pointer that is
pointer to node but it is going to return what void pointer to show you how to typecast this one.
Head is equal to new node so simply you can write head is. equal to. new node. Head is going
having 100 the address of the first node. going to contain zero now next thing is you have to
point this to this right so now you have. to store this address into this head. You simply write
head is equal to new new node then in this case also now head is going to contain head is
equals to new node. So simply how you can access this part this structure because this node is
having datatype structure so you can not simply except this one using arrow Prater.
We are going to store new node the new node is going to contain 300 so here we can insert
now. According to this coding we have lost the link to this node now this node is not in the so
now this you can not write so the solution of this problem is what you have to take one extra.
temp temp is equal to new node that is 200 fine when we were creating when we 're inserting
this second node fine press plus what you will write here temp is. not move this head we can we
can move this temp now right now here we can write temp of next because this node is having
two pointer this one this one. If user press 0 it means where you are not going to create another
node now we are going to print these values fine so for that what you will write after this what