Unconditional Control Statements

                     C supports Three types of Unconditional control statements.

                    These are 

                                1) break

                                2) continue

                                3) goto 

1. break:

                    break is an unconditional control statement and used to terminate a switch statement or a loop statement.

Syntax:

                    break;

Note:

1. In switch statement the variable or expression is an integral value(integer or character), we cannot use floating and string values.

2. In switch statement, the default case is optional.

2. Continue:

                    continue is an unconditional control statement and is used to passed the control.

                    Causes the control to pass to the end of the innermost enclosing while, do or for statement, at which point the loop continuation condition is revaluated.

Syntax:

                    continue;

3. goto:

                    goto is an unconditional control statement, which is used to alter the execution of the program sequence by transfer of control to some other part of the program.

Syntax:

                    goto    label;

                    where label is valid C identifier used to the label of the destination such that the control could transferred.

Syntax of label:

                    identifier :



Next Topic        :  Loop Control Statements

Previous Topic :  Conditional Control statements

No comments:

Post a Comment