Loading, please wait...

Control Structures

Decision Making 

Decision making is about deciding the order of execution of statements based on certain conditions or repeat a group of statements until certain specified conditions are met. C language handles decision-making by supporting the following statements.

 

Statement

Description

If statement

If the expression is true, then’ statement inside’ it will be executed, otherwise only statement outside is executed.

If…else statement

If the expression is true, the first statement block is executed, otherwise else statement block is executed.

Nested if statement

If the expression is false the last statement block will be executed, otherwise it continues to perform the test of expression first. If the expression is true the statement block is executed otherwise the next statement block is executed.

Switch statement

A switch statement allows a variable to be tested for equality against a list of values.

Nested switch statements

You can use one switch statement inside another switch statement(s).