LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Blogs > TheIndependentAquarius
User Name
Password

Notices


Data structures
Old
Rating: 2 votes, 5.00 average.

How to reverse a linked list? - C

Posted 02-01-2012 at 05:49 AM by TheIndependentAquarius



Code:
void reverseLinkedList ()
{
	linkedList *pointer1;
	linkedList *pointer2;
	
	pointer1 = NULL;
	pointer2 = head->next;
	
	while (pointer2 != NULL)
	{
		head->next = pointer1;
		
		pointer1     = head;
		head         = pointer2;
		pointer2     = pointer2->next;
	}
...
Attached Files
File Type: txt reverseLinkedList.txt (1.8 KB, 5 views)
Senior Member
Posted in Data structures
Views 1247 Comments 0 TheIndependentAquarius is offline

  



All times are GMT -5. The time now is 05:26 PM.

Main Menu
Advertisement
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration