Break Statement In C
The break command allows you to terminate and exit a loop (that is, do, for, and while). You can place a break command only in the body of a looping command or in the body of a switch command. The break keyword must be lowercase and cannot be abbreviated.
In a looping statement, the break command ends the loop and moves control to the next command outside the loop. Within nested statements, the break command ends only the smallest enclosing do, for, switch, or while commands.
In a switch body, the break command ends the execution of the switch body and transfers control to the next command outside the switch body.
For Example :
printf(" \nEnter the number :");
if (n < 0)
The Continue Statement In C
The continue statement can only appear in a loop body. It skipped the rest of the statement body in the loop.
continue; For Examples:
printf ("%i\n", loop);
goto Statement In C
goto is used for jumping from one statement to another. It is very negative approch to use goto in our program due its inherent properties of breaking the code.
Syntax : goto label;
Syntax : if condition then goto label;
For Example :
int n = 0;
Output will be displayed as:
Disadvantages Of goto Statement
Goto should not really be used in programs at all because they have a tendency to make code unstructured and they make programs difficult to manage when they become significantly large.