Start here · Essential guide
How to Use goto in C++
Learn how to use goto in C++: write a label and jump to it, see forward and backward examples, avoid compile errors, and pick safer alternatives.
Syntax and Functions
What the goto jump statement does and how to use it in C and C++.
Start here · Essential guide
Learn how to use goto in C++: write a label and jump to it, see forward and backward examples, avoid compile errors, and pick safer alternatives.
In C, goto jumps to a label in the same function. Here is the C syntax, the rules that differ from C++, and the cleanup-on-error pattern C code uses.
goto is a jump statement in C and C++. This article explains how it moves the program to a labeled line in the same function and why most code avoids it.
The goto command is a jump statement in C and C++ that needs a label to jump to. Here is how the two parts fit, with a full example and common mistakes.
Related topics