模拟实现strstr函数
int main() { char *p1,*p2; char a1[]="abbbcd"; char a2[]="bcd"; p1=a1; p2=a2; while(*p1!='\0'); { if(*p1!=*p2) { p1++; if(p2!=a2) p2=a2; } else { p1++; p2++; } } if(*p2=='\0') printf("Exist\n"); else printf("Not exist !\n"); system("pause"); return 0; }