In my main function, I create an array of objects of a certain class "Menu"
And when I call the function, I want to provide a pointer to this array.
Menu menu[2];
Function(POINTER_TO_ARRAY);
Question: What is the correct way to write function parameters?
I'm trying to:
Function(&menu);
and in the header file:
void Function(Menu *menu[]);
error: Cannot convert parameter 1 from Menu(*)[2] to Menu *[]
void Function(Menu * menu);
error: Cannot convert parameter 1 from Menu(*)[2] to Menu *[]
and I cannot think of another way to do this, and I cannot find a solution to this particular problem.
I just want to have access to the menu array inside the function using a pointer. What is the difference in a normal pointer to an array pointer?
source
share