i wrote that problem with easiest way can you check it again? bur the problem is: when i write this code with fgets the result is every time 0 but when i write with gets result is everytime 1. and then when i write with dev c++ result is correct. what can i do again
Code:
void FindWord(char *ptr){
char *strptr, word[20] = {""};
int i = 0, j = 0;
fgets(word,15,stdin);
strptr = ptr;
while ((strptr = strstr(strptr, word)) != NULL)
{
strptr++;
j++;
}
printf("%s occured %d times in the string\n", word, j);
}