title: What's the correct way of writing the hasNext() function in C?
body: <p>I'm working with lists and I'm a bit confused as to how hasNext() works.
  I thought it'd be like this:</p>
  <pre><code>int hasNext(const listADT list) {    
     return list-&gt;current-&gt;tail!= NULL;
  }
  </code></pre>
  <p>But I've seen it written like this:</p>
  <pre><code>int hasNext(const listADT list) {    
    return list-&gt;current != NULL;
  }
  </code></pre>
  <p>I'm not sure which one is correct. I thought that the last element was supposed to point to NULL. If that's not the case and the second version is correct, does that mean that NULL is counted as the last element of the list?</p>
  <p>EDIT: I'm trying to write a listADT to work with lists in general, there's not a specific thing I'm trying to do other than have a function that returns 1 if the current node has a next node.</p>
  <p>Here's the list's struct:</p>
  <pre><code>typedef struct listCDT {
     struct node * first;
     size_t size;
     node * current;
   } listCDT;
  </code></pre>
  <p>And the node's:</p>
  <pre><code>typedef struct node {
       elemType elem;
       struct node * tail;
    } node;
  </code></pre>
  <p>Thanks in advance.</p>