Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 16

Flow Control

C Programming Language

Contents
Statements and Blocks Conditional structure
If-Else Else-If

Iteration structures (loops)


While-do Do-While For

Jump statements.
The Break statement The Continue statement Goto and Labels Return and Exit

The selective structure


Switch

Statements and Blocks


{ statement1; statement2; statement3; }

Conditional Structure: If and Else


Being used to execute a statement or block only if a condition is fulfilled.
if (condition) statement

We can specify what happen if the condition is not fulfilled by

if (condition) else

statement1 statement2

Iteration structures (loops)


While-do loop Do-while loop For loop

The while loop


Format: while (expression) statement

The do-while loop


Format: do statement while (condition);

The for loop


Format: for (initialization; condition; increase) statement;

Jump statements
The Break statement The Continue statement Goto and Labels

The break statement


The break statement can leave a loop

The Continue statement


Causing the program to skip the rest of the loop in the current iteration

The goto statement

The exit function

The selective structure: Switch

The selective structure: Switch

You might also like