How do I write words broken by strtok in C to an array?
Here's the code, it splits an array of charms into strings:
#include <stdio.h>
#include <string.h>
int main(void) {
char str[]={"Test func strtok"};
char *istr;
char sep[]={" \n"};
istr=strtok(str,sep);
while (istr!=NULL) {
printf("%s\n", istr);
istr=strtok(NULL,sep);
}
return 0;
}
But how can I write the words that it has broken into an array individually(each word is a new element) for further work with each word?
0