/*** strstr.c ***/ #include<stdio.h> #include<string.h> //求字符串p中abcd出现的次数 //自定义函数接口完成业务函数和main函数分开 int getCount(char *mystr,char *sub,int *ncount) { int ret = 0; if(mystr == NULL || sub == NULL || ncount == NULL) { ret = -1; printf("one of point is NULL "); return ret; } int tmpCount = 0; char *p = mystr; //不要轻易改变形参的值 do { p = strstr(p,sub); if(p != NULL) { tmpCount++; p = p +strlen(sub); } else { break; } }while(*p != '