Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

Is the exit() function same as the return statement? Explain.

1040


Differentiate fundamental data types and derived data types in C.

987


What are the scope of static variables?

1119


What is 'bus error'?

1094


How many levels deep can include files be nested?

1104


What is substring in c?

1137


What does the format %10.2 mean when included in a printf statement?

1593


Are c and c++ the same?

1007


Which programming language is best for getting job 2020?

987


explain how do you use macro?

1100


Explain what does the function toupper() do?

1007


Write a program to print ASCII code for a given digit.

1040


Who developed c language?

1042


i got 75% in all semester am i eligible for your company

2173


Write a program to swap two numbers without using third variable in c?

1074