loading

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.3225094582727097","path":"main.c","file":{"path":"main.c","content":{"asEncoding":{"base64":"I2luY2x1ZGUgPHN0ZGlvLmg+CiAKaW50IGNoYXJhY3RlckNvdW50KGNoYXIgc3RyaW5nW10sIGNoYXIgbGV0dGVyKSB7CmludCB5ID0gMDsKCmZvciAoaW50IGkgPSAwOyBzdHJpbmdbaV0gIT0gMDsgaSsrKXsKCQlpZiAoc3RyaW5nW2ldID09IGxldHRlcikKICAgICAgeSA9IHkgKyAxOwp9CnJldHVybiB5Owp9CgppbnQgbWFpbiAoKSB7CgogICAvKiBsb2NhbCB2YXJpYWJsZSBkZWZpbml0aW9uICovCiAgY2hhciBteV9zdHJpbmdbXSA9ICJBbGwgYmVlcyBsaWtlIGNoZWVzZSB3aGVuIHRoZXkncmUgd2VhcmluZyBoYXRzLiI7CgogIGludCBjb3VudF9iID0gY2hhcmFjdGVyQ291bnQobXlfc3RyaW5nICwgJ2InKTsKCiAgcHJpbnRmKCIlZCIsY291bnRfYik7ICAgCiAgIHJldHVybiAwOwp9"},"asBuffer":null},"loaded":true}}
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;
}