title: strtok() seg fault
body: <p>I have already looked at other questions etc and i've seen you can't have a first arg in strtok that can't be edited but I don't think i have in this code but still getting a seg fault??
  Am i using strtok wrong?</p>
  
  <p>This code is to take stdin in csv comma delimited format and add the digits from the stdin then print them to stdout, p.s. i had it working when token wasn't a pointer eg. <code>i+= token;</code> but i was getting random output as would be expected i suppose.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  int main(){
  char *token, input[256];
  int i = 0;
  
  scanf("%s" , input);
  token = strtok (input, ",");
  
  while(token != NULL){
      token = strtok(NULL, ","); 
      i += *token;
  
          }                
  
  printf("%d\n", i);
  return 0;
      }
  </code></pre>
  
  <p>Thanks Lachlan</p>