char inputp1[132], inputp2[132], inputp3[132], inputp4[132], inputp5[132];
char input[MAX_NAME_SZ];
printf("-> ");
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<=len;i++)
{
if(input[i]==' ')
count++;
}
printf("the number of words are: %d\n",count + 1);
strcpy(inputp1, strtok(input , " ,-"));
for (count = count; count < 0; count-- )
{
strcpy(inputp2, strtok(NULL, " ,-"));
}
Okay so I have user input and im making it so that at every single ,- or space it will make a token.
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
strcpy(inputp2, strtok(NULL, " ,-"));
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
strcpy(inputp2, strtok(NULL, " ,-"));
and the second time
strcpy(inputp3, strtok(NULL, " ,-"));
ect.
Ex: I input 10 20 30
input and inputp1 come out as 10
inputp2 comes out as 20
inputp3 comes out as 30