Hello guys !
Here is the explanation regarding to implementation of Linked list , in a very easy way .
Its very basics and aimed to clear the the fundamental and logical structure of linked list . I hope you will appreciate this !
#include<stdio.h>
#include<stdlib.h>
struct node{
int data;
struct node* link;
};
struct node *head=NULL;
int main()
{
//creating first node
struct node *temp;
temp= (struct node*)malloc(sizeof(struct node));
temp->data = 2;
temp->link = NULL;
//connecting with head node
head = temp;
//creating another node
struct node *tempo;
tempo= (struct node*)malloc(sizeof(struct node));
tempo->data = 4;
tempo->link = NULL;
//traversing till NULL for connecting the created node to end .
struct node *temp1;
temp1=head;
while(temp1->link!=NULL)
{
temp1=temp1->link;
}
temp1->link=tempo;
//creating another node
struct node *tempoo;
tempoo= (struct node*)malloc(sizeof(struct node));
tempoo->data = 6;
tempoo->link = NULL;
//traversing till NULL for connecting the created node to end .
struct node *temp2;
temp2=head;
while(temp2->link!=NULL)
{
temp2=temp2->link;
}
temp2->link=tempoo;
//printing elements
struct node *a;
a=head;
while(a!=NULL)
{
printf("%d\n",a->data);
a=a->link;
}
}
Thanking you !
Excellent info on linked list. Thanks admin for the wonderful post
ReplyDeleteCloud Computing Courses in Chennai
Hadoop Training in Chennai
Digital Marketing Course in Chennai
Selenium Training in Chennai
JAVA Training in Chennai
German Classes in chennai
Big Data Training in Chennai
Big Data Course in Chennai
"Thanks for sharing a valuable topic in this Blog Really it is very helpful and interesting. All the best and do share such articles in future also.
ReplyDeleteDigital Marketing Training Course in Chennai | Digital Marketing Training Course in Anna Nagar | Digital Marketing Training Course in OMR | Digital Marketing Training Course in Porur | Digital Marketing Training Course in Tambaram | Digital Marketing Training Course in Velachery
"