how to use strtok() function to break the string into a series of tokens


#include
#include
#include
int main() {
char st[] ="Where there is will, there is a way.";
char *ch;
clrscr();
printf("Split \"%s\"\n", st);
ch = strtok(st, " ");
while (ch != NULL)
{
printf("%s\n", ch);
ch = strtok(NULL, " ,");
}
getch();
return 0;
}

No comments:

Post a Comment