My program's main function displays a switch menu. When option 1 is entered, a function is called that "shuffles" an array of "cards". After the shuffling is complete, that function returns the program to the beginning by calling main(), so that the menu is shown again.
The problem I have with this is that option 4 of the menu writes the shuffled array to a file. But when the cards are shuffled and then the program is restarted, the array data is lost, and therefore the outputted file is all junk. Is there a way to restart main() WITHOUT that data being lost?
I am in a class and am limited in the tools I can use, so only the most basic code will be acceptable. Basically, I'm looking for something like goto but a little safer (goto, by the way, is also forbidden in this class).