Explain the goto statement, C/C++ Programming

Assignment Help:

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.

 


Related Discussions:- Explain the goto statement

Write a c program to input five numbers, Write a C program to input five nu...

Write a C program to input five numbers and print them out on a new line e.g 5, 10, 15, 20, 25 displayed as   5   10   15   20   25 #include stdio.h   void main()   {

PLS URGENT HELP WITH C++, Pls i only need help with program 2. #include ...

Pls i only need help with program 2. #include #include using namespace std; int main() { int FilingStatus; cout cout cout cout cout cout

Decodethecode.h, decodes the sending smuggler string from the number format...

decodes the sending smuggler string from the number format into plain text

Need cron job parsing json from api, Need Cron Job Parsing JSON from API, I...

Need Cron Job Parsing JSON from API, Inserting in to DB Project Description: The Project is to prepare a Cron Job with an adjustable interval in seconds and milli seconds. Cr

Harcourt social studies, how would land elevation have changed if Coronado ...

how would land elevation have changed if Coronado had traveled 150 miles due west from what is today Arizona instead of east toward New Mexico

Compass bearing, write a c program that converts compass bearings into dire...

write a c program that converts compass bearings into direction

Custom scans and alerts think or swim, Custom Scans and Alerts Think or Swi...

Custom Scans and Alerts Think or Swim Project Description: I am seeking somebody to make me several Custom Scans and Alerts on Thinkorswim TOS Skills required are C++ Prog

Program of function overloading in c++ , Program of function overloading: ...

Program of function overloading: class vector{                 private :                 int v[3];                   public:                 /*friend istream &

Program with various inputs-set associative cache , 1.1 A Few Notes: 1....

1.1 A Few Notes: 1. Please test your program with various inputs prior to submission. 2. All group members must understand the entire project for interactive grading. Equal

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd