i'm getting segmentation fault core dumped when im using strtok at the next code part. the code is getting debugged but when I run it I get the segmentation fault. How can I fix it?
struct{ char *name;
void(*func)(void);
}cmd[]={
{"read_cm",read_cm},
{"NA",NULL}
};
int d;
char *s="_\n";
char *token2;
for(d=0;cmd[d].func!=NULL;d++)
{
token2=strtok((cmd[d].name),s);
}