Advertisement

How to do GOSUB with goto in C++

Started by May 02, 2000 03:29 AM
2 comments, last by Void 24 years, 7 months ago
Juz wondering, if anyone knows of a simple way to do a GOSUB routine easily in C++ Can''t really think of a simple way.. ..
GOSUB stands for Go to Subroutine
in basic, you couldn''t make your own functions, so you had to just start some code at line say 1000
then you''d call GOSUB 1000..

In C, you can create your own functions like this:
FunctionName(, , ...)
so for example:
int Multiply(int v1, int v2)
{
return v1+v2;
}

Advertisement
Wow! Been a long time since QBASIC!

If I''m not mistaken, BASIC does allow you to create functions and subroutines. Subroutines are really just functions that don''t return a value, so just use void as the return type:

void MySubroutine()
{
}




- null_pointer
Sabre Multimedia
In early BASIC (those GW-BASIC/BASICA time), they really don''t have subroutine. So they had this GOSUB/RETURN things.

As things got more advanced, functions/subroutines starts to appear in BASIC... and for compatibility sake, GOSUB/RETURN still stay (and decaying...)

IMHO, who needs GOSUB in C++ anyway?
"after many years of singularity, i'm still searching on the event horizon"

This topic is closed to new replies.

Advertisement