1 #include <stdio.h> 2 int getSubstrCount(char* str,char* subStr) 3 { 4 int count = 0; 5 while(*str) 6 { 7 int i; 8 //如果在大串中碰到相同的字符,则进入循环开始连续判断,如果出现不相同的则终止循环。如果完全相同则小串正常结束 9 for(i = 0;*(str+i) == *(subStr+i)&& *(subStr+i) != '
1 #include <stdio.h> 2 int getSubstrCount(char* str,char* subStr) 3 { 4 int count = 0; 5 while(*str) 6 { 7 int i; 8 //如果在大串中碰到相同的字符,则进入循环开始连续判断,如果出现不相同的则终止循环。如果完全相同则小串正常结束 9 for(i = 0;*(str+i) == *(subStr+i)&& *(subStr+i) != '