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
Why is c used in embedded systems?
what is different between auto and local static? why should we use local static?
please explain every phase in the "SDLC" in the dotnet.
Can a void pointer point to a function?
If you know then define #pragma?
What is variable in c example?
What is putchar() function?
What is a pointer in c plus plus?
What is the difference between a string and an array?
What is an lvalue in c?
What are the advantage of c language?
What is NULL pointer?
What are the differences between Structures and Arrays?
What is a good way to implement complex numbers in c?
What are the rules for the identifier?