函数功能:在一个字符串中进行搜索,查找所有在一个指定字符集中出现的字符
#include<stdio.h>
char*
find_char(char *source,char *chars)
{
char *temp;
while(source!=NULL&&chars!=NULL){
for(;*source!='\0';source++){
for(temp=chars;*temp!='\0';temp++){
if(*temp==*source){
return source;
}
}
}
return NULL;
}
}
int main()
{
char *s="hello";
char *t="hello boy";
char *dst;
dst=find_char(s,t);
puts(dst);
}