#define _CRT_SECURE_NO_WARNINGS
#include"stdio.h"
#include"stdlib.h"
#include"string.h"
#include<ctype.h>
int num(char *p, char *p2, int *n)
{
char *temp; //临时指针用来做判断
int k = strlen(p);//算出字符串Str的长度;也就是strinp的长度;
while (p2 != '\0') //如果到了那个比较长的字符串的末尾跳出循环
{
temp =strstr(p2, p);
if(temp!= NULL) //判断字符串STROUT。里面是否存在str 没有存放的话就等于null下面就直接跳出循环
{
(*n)++; //调入进来的n++;
p2 = p2 + strlen(p);
continue;
}
else
{
break;
}
}
}
int main()
{
char strinp[] = "crazyspopcorn"; //定义一个字符型数组变量
char strout[] = "crazyspopcornzuishuaiqilecrazyspopcornzuipiaole";
int n = 0;
num(strinp, strout, &n);
printf("%d",n);
system("pause");
}