/* Write the function int countchtr(char string[ ], int ch); which returns the number of times the character ch appears in the string. For example, the call countchtr(“She lives in NEWYORK”, ‘e’) would return 3. */ #include #include int countchar(char string[ ], int ch); void main() { char str[100],ch; int count; clrscr(); printf("\nEnter string :\n"); fflush(stdin); gets(str); printf("\nEnter the character you want to search: "); ch=getchar(); count=countchar(str,ch); printf("\n%c occurs %d times in the string.",ch,count); getch(); } int countchar(char string[ ], int ch) { int l,i,c=0,f; l=strlen(string); if(ch>=65 && ch<=90) f=32; else if(ch>=97 && ch<=122) f=-32; else f=0; for(i=0;i