title: strtol help why does it return a 0
body: <p>so i am confused as to why the inbuilt <code>strtol</code> is returning 0. From the manual it says it will <strong>return  0</strong> if no conversion is possible. Though too me it should convert properly. This is the function.</p>
  
  <pre><code>struct coin * addCoins(char *val){
      char *ptr =NULL;
      long int denomination = strtol(val, &amp;ptr,10);
      long int count = strtol( &amp;ptr,NULL, 10);
          printf("%d",count);
      struct coin *k;
      k = malloc(sizeof(struct coin));
      k-&gt;denom = denomination;
      k-&gt;count = count;
      return k;
  }
  </code></pre>
  
  <p>This returns long integers for the denomination of the coin, and how many of the coin's there are which are then stored in a struct of type coin. Which has the following <code>typedef</code>. </p>
  
  <pre><code>/* Each coin in the coins array will have a denomination (20 cents, 
   * 50 cents, etc) and a count - how many of that coin do we have on hand
   */
  struct coin
  {
      enum denomination denom;
      unsigned count;
  };
  </code></pre>
  
  <p>The format of the file being read in is as follows.
  <strong>The first column is the denomination, and the second is the count</strong>. </p>
  
  <pre><code>1000,3
  500,4
  200,20
  100,30
  50,5
  20,3
  10,40
  5,20
  </code></pre>
  
  <p>the delimiter being the comma. We where specifically told to use strtol, otherwise i would use <code>strtok_r</code>.</p>