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
printf(), scanf() these are a) library functions b) userdefined functions c) system functions d) they are not functions
What is the use of typedef in c?
7-Given an index k, return the kth row of the Pascal's triangle. For example, when k = 3, the row is [1,3,3,1]. For reference look at the following standard pascal’s triangle.
What is the difference between memcpy and memmove?
What is the difference between %d and %i?
What does 3 mean in texting?
Explain is it better to bitshift a value than to multiply by 2?
Why cant I open a file by its explicit path?
Explain how can you restore a redirected standard stream?
What does s c mean in text?
What is main function in c?
#define f(g,h) g##h main O int i=0 int var=100 ; print f ("%d"f(var,10));} wat would be the output??
I heard that you have to include stdio.h before calling printf. Why?
What are high level languages like C and FORTRAN also known as?
can we implement multi-threads in c.