In C programming language, there are control statements which do not need any condition to control the flow of execution of a program. Such statements are known as unconditional control statements.
The unconditional control statements provided by C are:
- break statement
- continue statement
- goto statement
Break Statement:
This is used for two important purposes:
- The break statement is used to terminate the switch case statement.
- It is used to terminate the looping statements like for, while and do-while.
Goto statement:
- This is a kind of jump statement which can take control of the program from anywhere to anywhere within a function.
- It is also referred to as an unconditional jump statement.
When a break statement is found inside the switch case statement, the execution control moves out of the switch statement.
Example:
#include <stdio.h>
void print_name( int roll_number)
{
switch(roll_number)
{
case 1:
printf("\n Name is A");
break;
case 2:
printf("\n Name is B");
break;
case 3:
printf("\n Name is C");
break;
default:
printf("\n Name is D");
break;
}
}
int main()
{
int roll_number = 1;
print_name(roll_number);
return 0;
}
Output:
Name is A
Diag-1:The break statement execution is as shown in the following figure.

continue statement:
It is similar to break statement, the only difference lies that break statement terminates the loop whereas continue statement, forces the control to reach for the next iteration of the loop that is to the beginning of the loop.
When we use continue statement with while and do-while statements the execution control directly jumps to the condition. When we use continue statement with for statement the execution control directly jumps to the modification portion (increment/decrement/any modification) of the for loop.
Diag-2: The break statement execution is as shown in the following figure.

Example:
It prints 0 to 10 except 5 as it goes to the beginning of the loop because of the continue statement.
int main()
{
for (int i = 0 ;i <=10; i ++) {
if (i == 5)
continue;
printf("%d ", i);
}
}
Output:
0 1 2 3 4 6 7 8 9 10
goto statement:
The goto statement is used to jump from one line to another in the program.
Simple C program to illustrate the concept of goto statement
#include <stdio.h> void print_name( int roll_number) { switch(roll_number) { case 1: printf("\n Name is A"); goto jump; break; default: printf("\n Name is D"); break; } jump: printf("\n I am in jump"); } int main() { int roll_number = 1; print_name(roll_number); return 0; }
OUTPUT:
Name is A
I am in jump
Note:
- Instead of “jump” we can use any name/label.
- break, goto, switch, case, if, else, if, all these are keywords in C.
- Avoid using them for general purposes like naming a variable.
Relevant Posts:
Categories: C Language
Leave a Reply