goto statement in C++

The goto statement is used to alter the normal sequence of the program execution by transferring control to some other part of the program.

In its general form, the goto statement is written as:

goto label;

Where label is an identifier that is used to label the target statement to which control will be transferred.

Control may be transferred to any other statement within the program. The target statement must be labeled, and the label must be followed by a colon.

Thus, the target statement will appear as:

label: statement

Each labeled statement within the program must have a unique label; i.e., no two statements can have the same label.

You may also like...

3 Responses

  1. christian says:

    Hi there, just wanted to mention, I loved this post.
    It was helpful. Keep on posting!

  2. david zitting says:

    Everything is very open with a precise description of the
    issues. It was truly informative. Your website is very
    helpful. Many thanks for sharing!

  3. Edwin says:

    Hello, I enjoy reading through your post.
    I wanted to write a little comment to support you.

Leave a Reply

Your email address will not be published. Required fields are marked *