Quote Originally Posted by Dregg View Post
This is the start of a pretty extensive assignment that we are supposed to build on for the rest of the semester, so I'm trying to keep everything somewhat 'futureproof', besides wouldn't it be silly to define a local varaible for each submenu?

What I was trying to achieve was a universal function for menu navigation to make the program easy to extend/update with new content, and also save a few lines of code. Maybe it is a bad idea? I just thought It would make it a bit simpler/cleaner, (since I would be reusing the same algorithm for each submenu anyway?)
I think it is generally silly to use global variables when you don't need them. It is considered bad practice for a variety of reasons that I am not going to get into. In particular, while working in a larger project with many header and source files it can cause a lot of problems since you make it harder for yourself to identify which variable has local as opposed to global scope. It also makes it tempting to edit values of global variables in an attempt to debug existing problems in your code, forgetting that it may be used in more than one place and introducing even more false apparent problems. It really is like driving your groceries on the top of your car instead of in your trunk, they tend to stay fresher but by the time you get home you realize you are missing half of them.

I suspect that your problem is not with getchar() in particular since you can easily read documentation for that online. I don't know what the structure of your menu is, but if it is as recursive as you make it look, then it might be best to keep track of the depth you are at using some counter. If you want to print your menu based on your depth, then you can indeed have a menu function which takes as parameters the user input (which you read in main, or wherever) and the current depth and figures out what it needs to display as options.