I want to know how to count how many words are in a string. I use strstr
to compare and it works but only works for one time
like this
char buff = "This is a real-life, or this is just fantasy";
char op = "is";
if (strstr(buff,op)){
count++;
}
printf("%d",count);
and the output is 1 but there are two "is" in the sentence, please tell me.
Aucun commentaire:
Enregistrer un commentaire