这是一段自己定义字符串函数strtok的代码,代码里面加粗的两行for循环里面的*start这个判断条件去掉后好像有问题,求解答
char * strPic(char *p,char *q);
char * strPic(char *p,char *q)
{
static char *start;
if(p)
start=p;
for(;*start && strchr(q,*start);start++);
if(*start==0)
return NULL;
char *req=start;
for(;*start && !strchr(q,*start);start++);
if(*start)
{
*start=0;
start++;
}
return req;
}
int main()
{
char pa[]=" ,OK This is The answer.But_I love you!";
char *c=strPic(pa," ,._");
while(c!=NULL)
{
cout<<c<<endl;
c=strPic(NULL," ,._");
}