title: Finding the largest value from a linked list
body: <p>I have to create a linked list containing 10 nodes, that each hold a double.
  I then have to search this linked list for the largest value in the linked list, and display the result.
  The program gets the values for each node from the user.
  Below is my method of traversing the list, trying to find the largest value.</p>
  <p>Locating the largest element. I think this is where my problem lies.</p>
  <pre><code>struct node *ptr = head;
  double largest = 0.0;
  while (ptr != NULL)
  {
       if (ptr-&gt;val &gt; largest)
            largest = ptr-&gt;val;
  
       ptr = ptr-&gt;next;
  }
  
  printf(&quot;The largest value is %lf \n&quot;, largest);
  </code></pre>
  <p>The program outputs: 0.0000</p>
  <p>I have no idea why.</p>