Friday, July 31, 2009

A function in C that will count the number of a certain character from a string of characters from the input.?

The user must be able to enter a string of any amount of characters and the output must count only one specific character. Thank you.

A function in C that will count the number of a certain character from a string of characters from the input.?
there is a string function that will do that, I just cant remember what its called. look in the string.h file, or documentation you have for the string functions.





another way is as the other person said. its a pretty easy routine to write, just try it.
Reply:An if statement iterating through the string until it finds the null.... A simple counter variable with an if statement that adds one to the counter every time target is found...

bottle palm

No comments:

Post a Comment