Why is it when I run the sub function programe is prefrectly fine but when I impliment it to the main programe it simply skip the input part... the fgets command....
here is the programe:
When come to the looksub function, it straight away go to the printf statement, without allowing me to key in my option.. Why !!!
printf ("Enter the String :");
fgets (str, sizeof str, stdin);
printf ("1/ Count Number of Characters In String.\n");
printf ("2/ Count Number of Words In String.\n");
void looksub (char str)
printf ("Enter the substring you want to find: ");
fgets (substr, sizeof substr, stdin);
p = strchr(substr, '\n');
if(p) *p = '\0';
if (strstr(str, substr))
printf ("The substring '%s' is found !!!", substr);
printf ("The substring '%s' is not found!!!", substr);
Here is an attachment of my file....