title: Infinite loop when trying to work with linked lists
body: <p>I'm just starting with C and I tried to write a simple linked list that adds integers until the number is 0, however I keeping getting an infinite loop with the last number I put on the list.
  I know it's probably because the last element isn't pointing to null, but I can't seem to fix it.</p>
  
  <p>Thank you :-)</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  int main () {
      struct nodo { 
          int num;
          struct nodo *sig;
      };
      nodo *l;
      nodo *aux;
      l=nullptr;
      int elem;
      scanf("%d", &amp;elem);
      while (elem!=0) {
          aux-&gt;num=elem;
          aux-&gt;sig=l;
          l=aux;
          scanf("%d", &amp;elem);
      }
      while (l!=nullptr) { 
          printf("%d", l-&gt;num);
          l=l-&gt;sig;
      }
  }
  </code></pre>