1. Engineering
  2. Computer Science
  3. cant seem to get my print link list function printing...

Question: cant seem to get my print link list function printing...

Question details

cant seem to get my print link list function printing in reverse order. only prints regular order. please help

C++

void linklist::reverse()
{
   node *curr = head;
   node *prev = NULL, *next = NULL;

   while (curr != NULL)
   {
       next = curr->next;
       curr->next = prev;
       prev = curr;
       curr = next;
   }
   head = prev;
}

main()[

//menu and switch statementts

case 13:
           cout << "Reversing listing: " << endl;
           ll.reverse();
           ll.printlist();
           cout << endl;
           break;

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution