title: Checking whether a linked list is empty in C++
body: <p>i'm trying to understand how is the statement in the while condition <code>while(C)</code> checking if a single linked list is empty. </p>
  
  <pre><code>node* remove(nodo*C, int y){
      FIFO F;                             
      while(C){                           
      if(C-&gt;info==y) {                    
          node* p=C;                  
          C=C-&gt;next;                  
          delete p;                   
          }
      else {                          
          F=metti_fondo(F,C);         
          C=C-&gt;next;                  
           }                              
       }
      if(F.fine)                          
          F.fine-&gt;next=0;                 
      return F.primo;
  </code></pre>
  
  <p>The data type used is:</p>
  
  <pre><code>struct node{int info; node* next; node(int a=0, node* b=0){info=a; next=b;}};
  </code></pre>
  
  <p>What i'm not understanding is how the simple reference of the node C is enough to check if the list is not empty. Shouldn't it be <code>while(C-&gt;next == 0)</code> or something like that? I checked and my version is not working, while the code shown before is working well.</p>
  
  <p>What does it checks exactly when i only reference the node C, without any reference to info or next fields?</p>
  
  <p>Thanks in advance</p>