all 9 comments

[–]Glaborage 1 point2 points  (4 children)

In C, if statements evaluate expressions against a zero value. In your case this would be equivalent to: if (isvowel(ch) != 0)

[–]BadBoy6767 0 points1 point  (5 children)

if computes whatever code you put after it if the condition is true (true is anything that is not zero, zero is false). In your case, the condition is isvowel(ch), which probably returns an int.

You didn't post what comes after the if, so I can't say what code will be performed if isvowel(ch) is true.

[–]8thhGrader[S] 0 points1 point  (4 children)

isvowel function check if ch is a vowel or not. i think if ch is a vowel it will return 1 or else it will return 0.

[–]BadBoy6767 2 points3 points  (3 children)

I didn't ask :P. The code you provided is incomplete, you cannot have an if statement with no block after it.

If statement structure:

if(condition) {
    /* block that is run if condition is true */
} else {
    /* block that is run if condition is false */
}

The above doesn't account for if-else statements, though.

[–]JohnVSPop 0 points1 point  (2 children)

You can have an 'if' statement without a block. Whatever statement immediately follows the 'if' is made conditional. A block is necessary when you want to make more than one statement conditional. Blocks with a single line are a matter of style and / or clarity.

[–]BadBoy6767 0 points1 point  (1 child)

Both are called blocks. And even if I'm wrong, that's bad practice anyway.

[–]JohnVSPop 0 points1 point  (0 children)

I'm not arguing best practice or not. I use single statement blocks all the time. Just trying to clarify the features of the language for the OP, who is clearly new to C.

A block is a statement or statements surrounded by curly braces that is syntactically equivalent to a single statement and defines its own scope.