I think I have already blogged it some where. It is very common question - next only to inversing the binary tree. Write a function to reverse a singly linked list. Would you like to write a recursive function? No, OK, let us write a non-recursive function for this. Let us say you have first three nodes n1, n2 and n3. Now simply link n2 to n1. Next take next three nodes n2,n3 and n4 and link n3 to n2. Continue this process until you reach the end of the list. Take n1, n2 = n1->next and n3 = n2->next Set n1->next = NULL. Because this will be your last node. Now link n2 and n1. That is set n2->next = n1. Now assign n1 = n2, n2 = n3 and n3 = n3->next Repeat 2 steps above until n3 = NULL. You still have one un-assigned node. Set that. n2->next = n1 Now n2 is your new head node. That's it. And now it is the coding time. #include<iostream> using namespace std; struct node { int n; node *next; }; class linked_list { node *h