Goto Statement in C++ by R4R Team

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;
}


output-

1 2 3 4 5




Leave a Comment:
Search
Categories
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!