int charcount(char* s,char x) { int count = 0,i=0; while(s[i]) { if (s[i] == x) count++; i++; } return count; }