![]() ![]() ![]() If it is false (expression is zero) and if there is an else part, statement2 is executed instead. The expression is evaluated if it is true (that is, if expression has a non-zero value), statement1 is executed. ![]() Formally the syntax is if (expression) statement1 else statement2 where the else part is optional. 3.2 If-Else The if-else statement is used to express decisions. (Variables can be declared inside any block we will talk about this in Chapter 4.) There is no semicolon after the right brace that ends a block. The braces that surround the statements of a function are one obvious example braces around multiple statements after an if, else, while, or for are another. Braces are used to group declarations and statements together into a compound statement, or block, so that they are syntactically equivalent to a single statement. printf(.) In C, the semicolon is a statement terminator, rather than a separator as it is in languages like Pascal. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |