1.while模型
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <stdlib.h> #include <string.h> //求一个字符串中某个子串出现的次数 int getCout(char *str, char *substr, int *count) { int rv = 0; char *p = str; int ncout = 0; if (str==NULL || substr== NULL || count==NULL) { rv = -1; printf("func getCout()check (str==NULL || substr== NULL || count==NULL) err:%d " , rv); return rv; } while (*p != '