c conditional statements tutorials

Bodhak c conditional statements tutorials in this chapter we will learn about Conditional statements, Working with if Simple if, if..else, if..else..if, nested if, Working switch statement, Rules for constructing switch. All the topics are explained in detail with syntaxes and examples.

CONDITIONAL CONTROL STATEMENTS: c conditional statements tutorials the conditional control statement(s) need to test the given expression based on the exit value i.e zero(false), non-zero(true) it needs to perform some set of instructions.



c conditional statements tutorials:-

For this the C language provides the following statements:



Nested if

else..if  ladder

if statement:

if is a decision-making statement that is used to test an expression and transfer the control to a particular statement depending upon the exit value of the statement.

if-else statement:

if the expression is true the statement(s) followed by if is executed.

if the expression is false the statement(s) followed by else are executed.

Syntax :

if < expression >

statement; (executed for true)


statement; (executed for false)

break is a statement that terminates an innermost loop or switch.

It can not be used outside of loop or switch case


switch..case conditional statement that provides multi-way branching from a particular point.

Syntax :


{   case label1:



case label2:

statements ;



statements;   }


Depending on the value of the expression, the control is transferred to a particular label.


If there is no label matching the value of expression control is transferred to default.


A break statement must be used to terminate a case if not the following case is also executed.