The Break Statement:-
The break statement causes an
immediate exit from the innermost loop structure. If we need to come out of a
running program immediately without letting it to perform any further operation
in a loop, then we can use break control statement.
Syntax:-
break;
The Continue Statement:-
The continue statement forces the next
iteration of the loop to take place, skipping any statement(s) following the
continue statement in the body of the loop.
Syntax:-
continue;
The Goto statement:-
The goto statement is used to transfer
the control in a program from one point to another point unconditionally. This
is also called unconditional branching.
Syntax:-
goto label;
Where label os a valid identifier to
indicate the destination wher a control can be transferred. Syntax of a lable
is lable;.
Exit() Function:-
The function exit() is defined in the
header file <stdio.h> and is used to termicate the program execution
immediately.
Syntax:-
exit (status);
Where ‘status’ is the termination value
returned by the program and is an integer. Normal termination usually returns
0.
Note:-
Some times exit() function is
confused with the break statement, though it works in a different way. Break
just terminates the execution of loop (or switch) where as exit() terminates
the execution of the program itself.
No comments:
Post a Comment