the goto statementthis statement can be used to


The goto statement

This statement can be used to branch to another statement of the program. This is rarely used as it violates the principle of structured programming. Though we can use it when we require to exit from deeply nested loops. The general format is :

goto label;

where label is a name(tag) followed by a colon.

e.g.

                for( . . . )

                 {

                                for( . . . )

                                {

                for( . . . )

                 {

                for( . . . )

 {

                if( condition)

                                goto cleanup;

 }

                                                 }

                                 }

                 }

 

cleanup: statements;

                                :

                                :

A good programmer will use control statements effectively in order to avoid the usage of unconditional branching statement - goto.

 

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: the goto statementthis statement can be used to
Reference No:- TGS0309282

Expected delivery within 24 Hours