title: Linked List Not Printing Out Correct Data
body: <p>I'm having trouble understanding why my printout method for my linked list implementation does not work. When the linked list has the numbers 1-5, it prints out 0è⌂è⌂ using the following code below:</p>
  <pre><code>void printList(List&amp; source, bool forward)
  {
      
      if (forward)
      {
          ListItr start = ListItr(source.first());
          while (!start.isPastEnd())
          {
              cout &lt;&lt; start.retrieve() +&quot; &quot;;
              start.moveForward();
          }
      }
      else
      {
          ListItr end = ListItr(source.last());
          while (!end.isPastBeginning())
          {
              cout &lt;&lt; end.retrieve() + &quot; &quot;;
              end.moveBackward();
          }    
      }
  
      cout &lt;&lt; endl;
  }
  </code></pre>
  <p>However, with my past implementation, it works just fine and I am confused as to why because they are identical but just with different variable placements.</p>
  <pre><code>void printList(List &amp;source, bool forward){
  
    ListItr itr;
  
    if(forward)
    {
      itr = ListItr(source.first());
  
      while(!itr.isPastEnd())
      {
        cout &lt;&lt; itr.retrieve() &lt;&lt; &quot; &quot;;
  
        itr.moveForward();
      }
  
    }
    else
    {
      itr = ListItr(source.last());
  
      while(!itr.isPastBeginning())
      {
        cout &lt;&lt; itr.retrieve() &lt;&lt; &quot; &quot;;
  
        itr.moveBackward();
      }
  
    }
  
    cout &lt;&lt; endl;
  
  }
  </code></pre>