Goto is the Jumping statement in C++
What is Jump statement?
-Jump statements cause an unconditional jump to another statement elsewhere in the code. They are used primarily to interrupt switch statements and loops.
How many jump statement in C++ ?
-break
-continue
-goto
Goto statement:
It is jumping statement in C++ which is absent in java or python programming language.
-It jump from one line to another specified line.
program:
#include < iostream>
using namespace std;
int main()
{
int i=1;
line:
cout<< i<<" ";
i++;
if(i<=5)
goto line;
return 0;
}
1 2 3 4 5