title: Reverse a LinkedList c++
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/11521452/unable-to-reverse-a-linked-list">Unable to reverse a linked list</a>  </p>
  </blockquote>
  
  
  
  <p>I'm trying to reverse a linked list:</p>
  
  <pre><code>void LinkedList::reverseList()
  {
      Node *next=_head;
      Node *prev=0;
      while(next!=0)
      {
          Node *tmp=next-&gt;_next;
          next-&gt;_next=prev;
          prev=next;
          next=tmp;
      }
  }
  </code></pre>
  
  <p>Lets say the list is: 4->3->2->1</p>
  
  <p>When I print the list, I only see 1 (The print function is good).</p>
  
  <p>Any help?</p>
  
  <p>Thanks</p>