69,373
社区成员
发帖
与我相关
我的任务
分享
#include <stdio.h>
char *fine_char(char const *source,char const *chars)
{
char *source_find=source;
char *chars_find=chars;
for( ;*source_find!='\0';source_find++)
{
for(;*chars_find!='\0';chars_find++)
{
if(*chars_find==*source_find)
return chars_find;
}
}
return 0;
}
int main()
{
char *a ="hello";
char *b ="e";
printf("%s\n",fine_char(a,b));
}
char *fine_char(char const *source,char const *chars)
{
char *source_find=source;
char *chars_find = NULL;
for( ;*source_find!='\0';source_find++)
{
if((chars_find = strstr(source_find,chars))!=NULL)
return chars_find;
}
return 0;
}
int main()
{
char *a ="hello";
char *b ="e";
printf("%s\n",fine_char(a,b));
}