- #1
kheiron1729
- 5
- 0
Code:
int main() {
int n;
char ch;
char* str;
int i;
printf("Enter the number of values you want to enter in your string: ");
scanf("%d", &n);
str = (char*)malloc(sizeof(char)*n);
printf("Enter the string: ");
getchar();
fgets(str, n, stdin);
printf("%s",str);
printf("Now enter the character you want to check for: ");
getchar();
scanf("%c", &ch);
printf("ok cool");
printf("The character '%c' occurs %d times", ch, count_char(str,ch));
return 0;
}
why is not working. I don't have much time and I am going to start with next problem. Can anyone who is adept at C help me with thing. Pretty please