How to pass an array of strings as a function argument?
I'm trying to create a simple function that will draw a menu with borders around it, but the options in the menu depend on what the menu is for. I may have 3 options in one menu and I might have 10 options in a different one.
I'm declaring an array of strings for the menu options like this:
Code:
char *menuops[] = {"Option 1", "Option 2"};
Counting how many options I have like this:
Code:
int nOps = sizeof(menuops) / sizeof(char *);
Then, creating a for loop and printing this menu options with the the borders is easy. Now the real problem... I want this to be in a function where I can call that function and pass as argument the variable menuops, cause in this case I have "Option 1" and "Option 2" but on a difference case I may have more options.
How can I achieve that?