Flow control in the C language refers to how a program makes decisions and repeats actions. It allows you to control the order in which instructions are executed, which is important for creating interactive, logical, and dynamic programs.

C provides three styles of flow control
- Branching
- Looping
- Jumping
Branching
Branching is so called because the program chooses to follow one branch or another.
if statement
This is the simplest form of the branching statements.
It takes an expression in parentheses and a statement or block of statements. If the expression is true, then the statement or block of statements gets executed; otherwise, these statements are skipped.
NOTE: An expression will be assumed to be true if its evaluated value is non-zero.
if statements take the following form:
if (expression)
statement;
OR
if (expression)
{
Block of statements;
}
OR
if (expression)
{
Block of statements;
}
else
{
Block of statements;
}
OR
if (expression)
{
Block of statements;
}
else if (expression)
{
Block of statements;
}
else
{
Block of statements;
}
?: Operator
The ?: operator is just like an if ... else statement, except that because it is an operator, you can use it within expressions.
?: is a ternary operator in that it takes three values; this is the only ternary operator C has.

?: takes the following form:
if condition? X: Y
if condition is true ? then X return value : otherwise Y value;
Switch statement
The switch statement is much like a nested if...else statement. It's mostly a matter of preference which you use; a switch statement can be slightly more efficient and easier to read.

Example
switch( expression )
{
case constant-expression1: statements1;
[case constant-expression2: statements2;]
[case constant-expression3: statements3;]
[default : statements4;]
}
Using break keyword
If a condition is met in switch case then execution continues on into the next case clause also if it is not explicitly specified that the execution should exit the switch statement. This is achieved by using break keyword.
Example
#include <stdio.h>
main()
{
int Grade = 'B';
switch( Grade )
{
case 'A' : printf( "Excellent\n" );
break;
case 'B' : printf( "Good\n" );
break;
case 'C' : printf( "OK\n" );
break;
case 'D' : printf( "Mmmmm....\n" );
break;
case 'F' : printf( "You must do better than this\n" );
break;
default : printf( "What is your grade anyway?\n" );
break;
}
}
What is default condition?
If none of the listed conditions is met then default condition executed.
Example
#include <stdio.h>
main()
{
int Grade = 'L';
switch( Grade )
{
case 'A' : printf( "Excellent\n" );
break;
case 'B' : printf( "Good\n" );
break;
case 'C' : printf( "OK\n" );
break;
case 'D' : printf( "Mmmmm....\n" );
break;
case 'F' : printf( "You must do better than this\n" );
break;
default : printf( "What is your grade anyway?\n" );
break;
}
}
Looping
Loops provide a way to repeat commands and control how many times they are repeated. C provides a number of looping ways.

while loop
The most basic loop in C is the while loop. A while statement is like a repeating if statement. Like an if statement, if the test condition is true, the statements get executed. The difference is that after the statements have been executed, the test condition is checked again. If it is still true, the statements get executed again. This cycle repeats until the test condition evaluates to false. This loop is used when we know the terminating condition.
The basic syntax of a while loop is as follows:
while ( expression )
{
Single statement
or
Block of statements;
}
Here the expression is the condition of termination.
for loop
A for loop is similar to a while loop; it's just written differently. For statements are often used to process lists, such as a range of numbers. It is used when we know the number of iterations.
The basic syntax of a for loop is as follows:
for( expression1; expression2; expression3)
{
Single statement
or
Block of statements;
}
In the above syntax:
- expression1 – Initialises variables.
- expression2 – Conditional expression: as long as this condition is true, the loop will keep executing.
- expression3 – expression3 is the modifier which may be a simple increment of a variable.
do...while loop
do ... while is just like a while loop except that the test condition is checked at the end of the loop rather than the start. This has the effect that the content of the loop is always executed at least once.
The basic syntax of a do...while loop is as follows:
do
{
Single statement
or
Block of statements;
}while(expression);
Jump Statements
Jump statements in C are used to alter the normal flow of a program by transferring control to another part of the code. They help in:
There are 3 types of Jump Statements
1. break
2. continue
3. goto
break and continue statements
C provides two commands to control how we loop:
- break – exit from loop or switch.
- continue – skip 1 iteration of loop.
You already have seen an example of using a break statement. Here is an example showing usage of the continue statement.
void main()
{
int i;
int j = 10;
for( i = 0; i <= j; i ++ )
{
if( i == 5 )
{
continue;
}
printf("Hello %d\n", i );
}
}
This will produce the following output:
Hello 0
Hello 1
Hello 2
Hello 3
Hello 4
Hello 6
Hello 7
Hello 8
Hello 9
Hello 10
goto statement
The goto statement in C is used to transfer control to a labelled part of the program. It is a jump statement that can move execution forward or backward in code.
Let us see an example of goto statement in C programming.
int main() {
printf("Step 1\n");
goto skip; // jump to 'skip' label
printf("Step 2\n"); // this line will be skipped
skip:
printf("Step 3\n");
return 0;
}
Output:
Step 1
Step 3
Note: goto is rarely used in modern programming because it can make code difficult to understand and debug. It’s generally avoided unless absolutely necessary.
Conclusion
Control statements in C are essential for directing the flow of a program. Branching, looping, and jump statements help in making decisions, repeating tasks, and altering the execution path. Mastering these allows programmers to write logical and efficient code.