/*请输入字符串 : I love my home要查找的串 : m7 12请按任意键继续. . .*/#include #include void FindWord(char *s, char *w) { //显示w在s中出现的索引位置 char *q,*p = s; int i,start; while(*p) { q = w; i = 0; if(*p == *q) { start = p - s; while(p[i] == q[i]) ++i; if(q[i] == '\0') printf("%d ",start); } ++p; } printf("\n");}int main() { char s[81],t[81]; printf("请输入字符串 : "); gets(s); printf("要查找的串 : "); gets(t); FindWord(s,t); return 0;}