Decision Control Statement in C

Decision Control Statement in C

Decision Control statement in C

Summary

(a)    There are three ways for taking decisions in a program. First way is to use the if-else statement, second way is to use the conditional operators and third way is to use the switch statement.

(b)   The default scope of if statement is only the next statement. So, to execute more than one statement they must be written in a pair of braces.

(c)    An if block need not always be associated with an else block. However, an else block must always be associated with an if.

(d)   If the outcome of an if-else ladder is only one of two answer then the ladder should be replaced either with an else-if clause or by logical operators.

(e)   && and || are binary operators, whereas,! Is a unary operator.

(f)     In C every test expression is evaluated in terms of zero and non-zero value is considered to be true.

(g)    Assignment statements used with conditional operators must be enclosed within a pair of parenthesis.

BCC

One thought on “Decision Control Statement in C”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.