C++ is one of the most versatile languages in the world. It is used nearly everywhere for everything… systems programming (operating systems, device drivers, database engines, embedded, Internet of Things, etc.)

Enter Header Image Headline Here

Saturday 15 April 2017

C++ goto Statement

                                       C++ goto Statement


In C++ programming, goto statement is user for altering the normal sequence of program execution by transferring control to some other part of the program,

Syntax of goto Statement





In the syntax above, lebel is an identifier. When goto lebel; is encountered, the control of program jumps to label: and executes the code below it.

Example : goto Statement









Output



You can write any C++ program without the use of goto statement and is generally considered a good idea not to use them.

Reason to Avoid goto Statement

The goto statement gives power to jump to any part of program but, mmakes the logic of the program complex and tangled.

In modern programming, goto statement is considered a harmful construct and a bed programming practice.

The goto statement can be replaced in most of C++ program with the use of break  ststement and continue ststement.





0 comments:

Post a Comment

Popular Posts

Recent Posts

Categories

Unordered List

Text Widget