title: Unused variable in C
body: <p>I'm currently coding a LinkedList implementation in C. I'm stumbling on the following problem: <code>variable 'currentNode' set but not used.</code></p>
  
  <p>I don't really understand this. I'm using the currentNode variable!</p>
  
  <p>This is my code:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  struct node {
      int val;
      struct node * next;
  };
  
  int main()
  {
      struct node root;
      root.val = 0;
      root.next = NULL;
  
      struct node currentNode;
      currentNode = root;
  
      int i;
      for (i = 0; i &lt; 10; ++i)
      {
          struct node newNode;
          newNode.val = i;
          currentNode.next = &amp;newNode;
  
          currentNode = newNode;
      }
  
      return 0;
  }
  </code></pre>