How does GOTO work? Im kind of a c programming dumbass...if you couldnt tell....
Basically goto statement causes the cpu to jump from one part of the code to another. The place to jump to is defined by a label. Although goto is useful sometimes, it is frowned upon by most people and there usually are other better ways of achieving the same effect. Here is an example -
Code:
int main()
{
int x = 3;
jump:
{
x = 4;
cout << "Hi" << endl;
}
if(x == 3)
goto jump;
return 0;
}
BTW, Goto was present in C as well.