write the function int countchtr(char string[],int
ch);which returns the number of timesthe character ch
appears in the string. for example the call countchtr("she
lives in Newyork",'e') would return 3.
Answer Posted / goloap
int countchtr(char *str, char ch)
{
int count=0;
char *itr = str;
while (*itr != '\0')
{
if(*itr == ch)
{
count++
}
itr++;
}
return count;
}
| Is This Answer Correct ? | 4 Yes | 0 No |
Post New Answer View All Answers
Is r written in c?
Is a house a shell structure?
How can you increase the allowable number of simultaneously open files?
How can you allocate arrays or structures bigger than 64K?
Why main is not a keyword in c?
Devise a program that inputs a 3 digit number n and finds out whether the number is prime or not. Find out its factors.
What is the difference between union and structure in c?
What is c standard library?
What is the difference between a free-standing and a hosted environment?
How can I recover the file name given an open stream?
What is a pointer value and address in c?
shorting algorithmS
What is the c value paradox and how is it explained?
What is the use of #define preprocessor in c?
Explain the priority queues?