Write count_char(s, c) to count how many times the character c is in the string s. Upper and lower case are different letters. A C string ends with '\0'.
count_char("banana", 'a')→3count_char("", 'x')→0int count_char(const char *s, char c)int count_char(const char *s, char c) {
int n = 0;
for (int i = 0; s[i] != '\0'; i++) {
// your code here: if this character is c, add 1 to n
}
return n;
}
Run tries the examples. When they look right, Submit.