×
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
670    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
Pure mathematics is, in its way, the poetry of logical ideas.
Albert Einstein
2754
34.21
Today So Far
Total View (Lakh)
softetechnologies
01/01/2018     33611
28/06/2017     29530
02/08/2017     27024
26/05/2018     26987
15/05/2017     23239
06/07/2017     21773
01/08/2017     21320
25/06/2018     20153
21/04/2018     18620
14/07/2017     16470
softetechnologies