一道题目
#define NULL (void *)0//我这里是不是有错误?
char *find_char(char const *source,char const *chars)
{
if(source==NULL||chars==NULL||
*source=='\0'||*chars=='\0')
return NULL;
while(*chars!='\0')
{
while(*source!='\0')
if(*chars==*source)
return source;//12行就是这一行
else
source++;
chars++;
}
return NULL;
}
char *find_char(char const *source,char const *chars)
{
if(source==NULL
[解决办法]
chars==NULL
[解决办法]
*source=='\0'
[解决办法]
*chars=='\0')
return NULL;
while(*chars!='\0')
{
char* s = source;
while(*s!='\0')
if(*chars==*s)
return s;//12行就是这一行
else
s++;
chars++;
}
return NULL;
}