Hello guys, I'm working on program to count letter b,r and w in a string. I keep getting errors please help
What compiler are you using? Your compiler should tell you, when you compile, what your errors are and what line you can find them at.
1_ You're missing your function name before you open your brackets on line 8
2_ on line 15, if you want to check for the character a : a character is written between inverted commas, in such manner 'a'.
3_ your function isn't actually returning acount, rcount, or wcount. AND wcount will be incremented for EVERY character that ISN'T 'a' or 'r', is that what you intend?
Your compiler, whatever it is, won't help you much with the things wrong with your code.
Your main is OK, but your 3 functions show that you probably don't quite get it how functions work.
You only need 1 function header which defines the general case where you specify the string and the character to count (whatever you decide on) and then return with how many. Despite the bloopers I would imagine that you want to specify other characters, not just 'b', 'r' and 'w'. and that's what the general case allows you to do.
Read my code along with H00G0's comments and you'll get more out of it than from a compiler.