LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
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 1124 Comments 0 TheIndependentAquarius is offline

  



All times are GMT -5. The time now is 11:28 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration