title: Strtok inside a for statement
body: <pre><code>    char inputp1[132], inputp2[132], inputp3[132], inputp4[132], inputp5[132];
  
      char input[MAX_NAME_SZ];
      printf("-&gt; ");
      fgets (input, MAX_NAME_SZ, stdin); // user input
      input[strcspn(input, "\n")] = 0;
  
      int count=0,i,len; //counting
  
      len = strlen(input); 
      for(i=0;i&lt;=len;i++) 
          {  
         if(input[i]==' ') 
            count++;
          }
  
      printf("the number of words are: %d\n",count + 1);
  
  
      strcpy(inputp1, strtok(input , " ,-"));
      for (count = count; count &lt; 0; count-- )
      {
      strcpy(inputp2, strtok(NULL, " ,-"));
      }
  </code></pre>
  
  <p>Okay so I have user input and im making it so that at every single ,- or space it will make a token.</p>
  
  <p>What im wondering is is their a way to make a for statment so that for every single string after a space it will run </p>
  
  <pre><code>strcpy(inputp2, strtok(NULL, " ,-"));
  </code></pre>
  
  <p>Also I would like it to count up for every single time so that the first time it ran the for function it would do </p>
  
  <p><code>strcpy(inputp2, strtok(NULL, " ,-"));
  </code> </p>
  
  <p>and the second time</p>
  
  <p><code>strcpy(inputp3, strtok(NULL, " ,-"));
  </code></p>
  
  <p>ect.</p>
  
  <p>Ex: I input 10 20 30</p>
  
  <p>input and inputp1 come out as 10</p>
  
  <p>inputp2 comes out as 20</p>
  
  <p>inputp3 comes out as 30</p>