The problem with this function is that it looks after all the substrings, but not for words like for example if I'm looking for "hi" within "hifive to to evereyone" it returns 1
int HowManyString(char *satz,char *word) {
int coun = 0;
while (strlen(word)<strlen(satz)) {
if (strstr(satz,word)==NULL) {
return coun;
} else {
satz=strstr(satz,word)+strlen(word);
if(*(satz)==' '||*(satz)=='\0'){
coun++;
} else {
return coun;
}
}
}
return coun;
}