title: remover 0s from end of linked list
body: <p>I want to remove all zeors occuring at the end of an linked list:
  example</p>
  
  <pre><code>5-&gt;6-&gt;0-&gt;5-&gt;0-&gt;0
  </code></pre>
  
  <p>should became</p>
  
  <pre><code>5-&gt;6-&gt;0-&gt;5
  </code></pre>
  
  <p>I have tried this but its not working:</p>
  
  <pre><code>ListNode * N=L.getHead(),*t;
  while(N!=NULL){
      if(N-&gt;getNext()-&gt;getData()==0){
          t=N;
          while(N!=NULL &amp;&amp; N-&gt;getData()==0){
              N=N-&gt;getNext();
          }
          if(N==NULL)
              t-&gt;setNext(NULL);
      }else
      N=N-&gt;getNext();
  }
  </code></pre>
  
  <p><strong>Notes:</strong></p>
  
  <ul>
  <li>L is an object of an class</li>
  <li>ListNode  is another class</li>
  <li><code>getHead()</code> returns first node address</li>
  <li>next in class is private so cant access it directly.</li>
  </ul>