here is my code,
#include <string.h>
#include <stdio.h>
main ()
{
explode (" ", "this is a text");
}
explode (char *delimiter, char string[])
{
char *pch;
printf ("Splitting string \"%s\" into tokens:\n",string);
pch = strtok (string,delimiter);
while (pch != NULL)
{
printf ("%s\n",pch);
pch = strtok (NULL, delimiter);
}
return 0;
}
I compile this code using gcc -o 1.exe 1.c
and shows no error. But when i execute 1.exe
it shows Splitting string "this is a text" into tokens:
and at that moment 1.exe
stops working (a dialogue box of windows shows). can anybody tell the problem and solve the problem? I am using windows 10.