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 the exit() function same as the return statement? Explain.
Differentiate fundamental data types and derived data types in C.
What are the scope of static variables?
What is 'bus error'?
How many levels deep can include files be nested?
What is substring in c?
What does the format %10.2 mean when included in a printf statement?
Are c and c++ the same?
Which programming language is best for getting job 2020?
explain how do you use macro?
Explain what does the function toupper() do?
Write a program to print ASCII code for a given digit.
Who developed c language?
i got 75% in all semester am i eligible for your company
Write a program to swap two numbers without using third variable in c?