如题所述
第1个回答 推荐于2016-07-24
int FindsubString(const char *sourceStr,const char *substr)
{
int counter=0;
unsigned int length=strlen(substr),index;
source=sourceStr;
while(*source)
{
index=0;
while(*(substr+index) && index<length)
{
if(*(substr+index)==*(source+index))
{
index++;
}
else
break;
}
if(*(substr+index)=='\0')
{
counter++;
}
source++;
}
return counter;
}本回答被提问者和网友采纳
{
int counter=0;
unsigned int length=strlen(substr),index;
source=sourceStr;
while(*source)
{
index=0;
while(*(substr+index) && index<length)
{
if(*(substr+index)==*(source+index))
{
index++;
}
else
break;
}
if(*(substr+index)=='\0')
{
counter++;
}
source++;
}
return counter;
}本回答被提问者和网友采纳