×
FREE ASSISTANCE FOR THE INQUISITIVE PEOPLE
Tutorial Topics
X
softetechnologies
Display The Link List Elements In C Sort the List Elements - Link List in C
Reverse The Link List Elements - Link List in C - Link list - C Language
1935    Arnab De    07/09/2019

We can reverse the linklist elements by adjusting the node references only. That is, change the fist node into last.

softetechnologies
node *rev(node *l)
{
	node *temp1,*temp2,*temp3;
	int c=1;
	temp1=l;
	temp2=l;
	do
	{
		temp3=temp2->next;
		if(c==1)
		{
			temp2->next=NULL;
			temp2=temp3;
			temp3=temp3->next;
		}
		else
		{
			temp2->next=temp1;
			temp1=temp2;
			temp2=temp3;
			temp3=temp3->next;
		}
		c++;
	}while(temp3!=NULL);
	temp2->next=temp1;
	return temp2;
}
softetechnologies
Display The Link List Elements In C Sort the List Elements - Link List in C
softetechnologies
Author Details
Arnab De
I have over 16 years of experience working as an IT professional, ranging from teaching at my own institute to being a computer faculty at different leading institute across Kolkata. I also work as a web developer and designer, having worked for renowned companies and brand. Through tutorialathome, I wish to share my years of knowledge with the readers.
Enter New Comment
Comment History
No Comment Found Yet.
Albert Einstein
Learn from yesterday, live for today, hope for tomorrow.
Albert Einstein
2746
80.78
Today So Far
Total View (Lakh)
softetechnologies
26/05/2018     54120
25/06/2018     45120
01/01/2018     43671
28/06/2017     41205
02/08/2017     40220
01/08/2017     34265
06/07/2017     34064
15/05/2017     33304
11/09/2018     30321
14/07/2017     29830
softetechnologies