69,368
社区成员
发帖
与我相关
我的任务
分享
int findstr(char *dst)
{
int dst_len,num=0;
char *str_tmp=(char *)malloc(4);
while(*dst!='\0')
{
strncpy(str_tmp,dst,3);
if(strcmp(str_tmp,"the")==0)
{
num++;
}
dst++;
}
return num;
}
int main(int argc, char* argv[])
{
int t=0;
t = findstr("the num the The,,THE the");
printf("%d",t);
return 0;
}
char *str_tmp=(char *)malloc(4);
memset(str_tmp, 0, 4);