title: Returning sum of values in linked list
body: <p>I have the following code: </p>
  
  <pre><code>int sum(LinkedList * list) {
  
    assert(list!=NULL);
  
    Node *currentNode = list-&gt;head;
    int sum = 0;
  
    for (currentNode = currentNode-&gt;next; currentNode !=NULL; currentNode = currentNode -&gt; next) {
          sum = sum + currentNode-&gt;data;
  
          }
    return sum;
  
  }
  </code></pre>
  
  <p>I want it to return the sum of all the values in the linked list *list. However, I keep getting a segmentation fault. Can anyone help me spot the fatal error?</p>