Error when calling a function that was sent an array

I'm trying to make a menu for my project where i can navigate between different things and be able to go back in the order i came in.
I get the error variable sized object 'menustack' may not be intialized. It hightlights the for loop inside my function that is being sent an array. What i want it to do is check each value in the array starting from the beginning until it hits a zero where each time its not a zero it will deposit the array{x} into a variable.

Here is my code. (I excluded parts of code in the project that were unrelated to make it easier to read)

int analogValue;
const int buttonPin8 = 8; // the number of the pushbutton pin
const int buttonPin9 = 9; // the number of the pushbutton pin
const int buttonPin10 = 10; // the number of the pushbutton pin
int menustack[6]={0,0,0,0,0,0};
int currentmenuspot=1;
int buttonState = 0; // variable for reading the pushbutton status

void setup()
{
pinMode(buttonPin8, INPUT); //switch on pin 8
pinMode(buttonPin9, INPUT); //switch on pin 8
pinMode(buttonPin10, INPUT); //switch on pin 8
serial.begin(9600);
clearScreen();
}

void loop()
{

findsmenuspot(menustack); //finds current spot by checking array
switch(currentmenuspot) //uses value from array to jump to other menus
{
case 1: mainmenu();
break;
case 2: COsense();
break;
case 3: Temp();
break;
case 4: Text();
break;
}

if(digitalRead(buttonPin8)==LOW)
{
//do something
}
else if(digitalRead(buttonPin9)==LOW)
{
//do something
}
else if(digitalRead(buttonPin10)==LOW)
{
//do something
}
}

int findsmenuspot(int menustack[])
{
for(int c=0, menustack

=!0, c++ ) //here is the line that the error is hightlingting
      {
        currentmenuspot=menustack[c];
      }    
}



[serial_lcd_CO_sensor_multi_menu.ino|attachment](upload://psxGVohjVT0la3soVjSWoyHgYV1.ino) (2.22 KB)

It's highlighting that line because that's where the errors are. In your line:

 for(int c=0, menustack[c]=!0, c++ ) //here is the line that the error is hightlingting

the three expressions in the for loop are separated by semicolons, not commas. However, because you used a comma, and those are allowed in complex expressions, it saw the second expression as an attempt to initialize menustack[]. Also, I don't think you wanted the operator to be "=!" which is an attempt to assign "NOT zero" into menustack
```c
*[/i]. I think you want "!=", not equal to. Finally, another comma appears before the third expression. Since you used commas, the compiler thinks you're still initializing the first expression since the expressions are terminated with a semicolon, not a comma. Try:

 for(int c = 0; menustack[c] != 0;  c++ ) //here is the line that the error is hightlingting

Since all of the elements in menustack[] are zero, perhaps you did mean NOT zero. If so, that a weird way to do things.*
```

Thank you the reply and help. Replacing the commas with semi colons did it Thank you.
The technique I'm using is having a global array act as a stack where the first spot array[0] is the main menu and array[2] is the next menu and so fourth. The rest of the array is filled with zeros so that when i check the array starting from the beginning it skips over spots that have a value until it hits a zero which means that spot no more menus were traveled to. So now i can use the values in the array and go backwards and hop to each menu in order.

I'm not an experienced programmer, so this maybe totally wrong or inefficient, but it looks good on paper and I'm trying to see it will work. My menu stack only goes to maybe 4 sub-menus the most.