#include<stdio.h>#include<string.h>char buf[1024],search[128];int main(){ printf("Read String:");scanf("%s",buf); printf("Read Substr:");scanf("%s",search); char * pos = strstr(buf,search); if (pos==NULL) printf("Can't found \"%s\"\n",search); else printf("%d\n",pos-buf+1); return 0;}利用string.h库函数strstr()查找子串