A couple of questions from a beginner

Hi! I'm new around here and I would like answers for my following questions please.

1) I am trying to make a game and I don't want the problems onf nested functions all the time. Is there any way around this?

2) How can you run multiple functions at once? At the moment I can only run the main() and then call functions e.t.c

Any help would be much appreciated.

Thanks in advance,
Sperry
What do you mean by 'nested' functions?
And to run several functions at once, there are threads.
Thanks, can you direct me to one of these threads please?

Nested functions:
int main()
{
SomeFunction();
}

void SomeFunction()
{
SomeOtherFunction();
}

Yeah, see what I mean? If this goes on constantly, it gets anoying
closed account (Lv0f92yv)
I think Athar meant threads as in multithreading - running your program under more than one thread. This would cause your processor to 'splice' time between multiple threads of your program, and in the case of 2 or more cores, each thread would be literally executing at the same time. Either way, you could conceptually think of each thread as running simultaneously.

You are always going to have to call functions from within other functions, or from classes. I don't think there is a way around this. Functions are placed on the call stack - not the heap (in memory), so even conceptually, only one function can be executing at any given time, except in multithreaded environments.
Having functions that perform a well-defined task and building functions that perform greater tasks by calling various other functions is the core concept of imperative programming, so you won't get around it. It certainly is not a 'problem'.
Topic archived. No new replies allowed.