Skip to content
← Back to Community
how can i fix the fgets
Profile icon
OnonijahJaelJae

#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<ctype.h>
int main(void)
{//initializing the charecter and variabrle
char sentece[3][90];
char search[60];//initializing search
char *searchPrt;//initializing pointer
int count = 0;//initailzing count
int a;
int y;
printf("Enter the text:\n ");
//reading the line of text
for (a = 0; a <= 2; a++)
{
fgets(&sentece[a][0], search, count);
}
for (a = 0; a <= 2; a++)
{
for (y = 0; sentece[a][y] != '\0'; y++)
{
sentece[a][y] = tolower(sentece[a][y]);
while (searchPrt = strstr(searchPrt, search))
{
++count;
searchPrt++;
}
}
printf("\n the total occurrence of string"%s "in the text is: %d\n", search, count);
return 0;
}
}

Voters
Profile icon
OnonijahJaelJae
Comments
hotnewtop
Profile icon
[deleted]

What is your program meant to do?