loading
open in
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <stdio.h>
 
int characterCount(char string[], char letter) {
int y = 0;

for (int i = 0; string[i] != 0; i++){
		if (string[i] == letter)
      y = y + 1;
}
return y;
}

int main () {

   /* local variable definition */
  char my_string[] = "All bees like cheese when they're wearing hats.";

  int count_b = characterCount(my_string , 'b');

  printf("%d",count_b);   
   return 0;
}