C++ goto statement

In this tutorial you will learn about the C++ goto statement and its application with practical example.

C++ goto statement

In C++, goto statement is used to alter the normal execution of a program and transfer control to a labeled statement in the same program. In a C++ program we can have multiple goto and label statements, the goto statement is followed by a label name. Label is an identifier, which can be any plain text and can be set anywhere in a C++ program above or below to goto statement. When a goto statement is encountered, compiler transfers the control to a label: specified with goto statement and begin execution from there.

Table Of Contents

Syntax:-

Program Structure:-

Example:-

Output:-

cpp_goto_statement_example

In this tutorial we have learn about the C++ goto statement and its application with practical example. I hope you will like this tutorial.