Following is my code and getting segmentation fault. Please help
#include<stdio.h>
#include<string.h>
main()
{
char *p,str[100]="Hi, How Are You, Fine, Thank You";
p=strtok(str,",");
printf("%s\n",p);
while(p != NULL)
{
p=strtok(NULL,",");
printf("%s\n",p);
}
}
O/p is:
Hi
How Are You
Fine
Thank You
and then Segmentation fault.