Hi, just a question about functions. For example, i have a main function, which calls a displayMenu func, this then calls a series of other functions until finally the gameOver function is called. At the end of this function, i call displayMenu again to show the menu, so that the user may replay the game if they wish. My question is, would my computer create the 2nd displayMenu function within the gameOver function (already an extension of my first displayMenu function) or would it overwrite as such, the first menu call i did at the beginning of my program. I think i've explained that diabolically, so i'll try and draw a little graphic:
Would my calling the 2nd menu function make the computer do something like this:
etc etc...Code:main displayMenu someotherFuncs gameOver displayMenu someotherFunctions gameOver displayMenu
or would it do this:
etc etc...Code:main displayMenu someotherFuncs gameOver displayMenu someotherFuncs gameOver displayMenu
I am currently writing a snake game, and at first i had the main menu running in a while loop and calling appropriate functions until the user entered the exit command. however this produced some weird results, so i changed to calling the main menu function whenever the game finished instead of just exiting back into the loop. This got me thinking about my above question, as if the answer is indeed the first case, this cant be very good for my computer when running the program at all hehe.
ps. I think i'm going for the record on most uses of the word 'function' in a thread.
any help greatly appreciated