If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register or Login
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Re: isvowel function

Re: isvowel function

As it stands, your program shouldn't compile as isVowel(..) is supposed to return a type bool but the function doesn't have a return statement! Also, your main function should return a value as well (usually 0).

I forgot to indent as I was working,

Indenting of code as you enter/change it should become second nature. It makes reading and understanding it so much easier - especially when it comes to trying to work out why a program doesn't function as expected.

All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.
C, C++ Compiler: Microsoft VS2015

Re: isvowel function

Originally Posted by 2kaud

As it stands, your program shouldn't compile as isVowel(..) is supposed to return a type bool but the function doesn't have a return statement!

It only results in undefined behaviour, hence a compiler might still compile the program. However, it probably would result in a warning, so... psfign: consider increasing the warning level of your compiler.

Originally Posted by 2kaud

Also, your main function should return a value as well (usually 0).

That's optional since a missing return statement for the global main function would be as if return 0; was present at the end.

Re: isvowel function

I don't know how to do the return statement

To return a value from a function, the return statement is used. The format is

return val;

where val is the data you want to return and has the same type as that defined with the function definition. In your case isVowel(.) needs to return a value of type bool which is true if ch is a vowel and false otherwise.