passing a 2d array

Trying to pass a 2d array (gameBoard) form main to initialiseBoard but keep getting ' error C2059: syntax error : ']' ' here's a cut down version of my code below
Any help would be appreciated

const int BOARDWIDTH =5;
const int BOARDhEIGHT =5;

void initialiseBoard(bool gameBoard[][BOARDHEIGHT],const int BOARDWIDTH)
{

for (int y=BOARDHEIGHT-1;y>-1;y--)
{
for (int x=0;x<BOARDWIDTH;x++)
{
//set each square to 'occupied' (true)
gameBoard [x] [y] = true;

}//end of for loop
}//end of for loop
}

int main()
{

bool gameBoard [BOARDWIDTH] [BOARDHEIGHT];

//start game
//initialise the board
initialiseBoard(gameBoard[][BOARDHEIGHT],BOARDWIDTH);
}
You are passing gameBoard incorrectly to InitialiseBoard().

InitialiseBoard(gameBoard[][BOARDHEIGHT],BOARDWIDTH);

shoud be

InitialiseBoard(gameBoard,BOARDWIDTH);
Sorted thanks
I can't resist linking this since I just finished it, and it's somewhat on point:

http://cplusplus.com/forum/articles/17108/

*Disch stabs multidimentional arrays with a vorpal dagger*
Last edited on
Topic archived. No new replies allowed.