Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Void

How to do GOSUB with goto in C++

This topic is 6933 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.. ..

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
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;
}

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!