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 r written in c?

1149


Is a house a shell structure?

1158


How can you increase the allowable number of simultaneously open files?

1150


How can you allocate arrays or structures bigger than 64K?

1132


Why main is not a keyword in c?

1250


Devise a program that inputs a 3 digit number n and finds out whether the number is prime or not. Find out its factors.

1118


What is the difference between union and structure in c?

1168


What is c standard library?

1201


What is the difference between a free-standing and a hosted environment?

1142


How can I recover the file name given an open stream?

1005


What is a pointer value and address in c?

1123


shorting algorithmS

2252


What is the c value paradox and how is it explained?

1050


What is the use of #define preprocessor in c?

1069


Explain the priority queues?

1073