Write function headers for the functions described below:
(iv) The function countChar returns the number of occurrences of a character in a string, both provided as parameters
int countChar(char character, char* text){
int counter =0;
for(int i =0; i<sizeof(text)/sizeof(text[0]) ;i++){
if(text[i]==character) counter++;
}
return counter;
}
Comments
Leave a comment