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
The number of measuring units from an arbitarary starting point in a record,area,or control block to some other point a) recording pointer b) offset c) branching d) none
What is indirection?
Is Exception handling possible in c language?
How can I delete a file?
In C language, a variable name cannot contain?
Is r written in c?
The program will first compute the tax you owe based on your income. User is prompted to enter income. Program will compute the total amount of tax owed based on the following: Income Tax 0 - $45,000 = 0.15 x income $45,001 - $90,000 = 6750 + 0.20 x (income – 45000) $90,001 - $140,000 = 15750 + 0.26 x (income – 90000) $140,001 - $200,000 = 28750 + 0.29 x (income – 140000) Greater than $200,000 = 46150 + 0.33 x (income – 200000) Dollar amounts should be in dollars and cents (float point numbers with two decimals shown). Tax is displayed on the screen.
What is spaghetti programming?
What is the scope of local variable in c?
Why c is called a middle level language?
Is stack a keyword in c?
What are the disadvantages of a shell structure?
PROGRAM TO WRITE CONTENTS OF 1 FILE IN REVERSE TO ANOTHER FILE,PROGRAM TO COPY 1 FILE TO ANOTHER BY SPECIFYING FILE NAMES AS COMMAND LINE
Find MAXIMUM of three distinct integers using a single C statement
Is it possible to use curly brackets ({}) to enclose single line code in c program?