This code is giving me the error "expected primary-expression before ']' token." After googling and looking around Daniweb I still cannot find what this means. Can anyone enlighten me?

int board[*width][*height];
          if(OpenBoard(boardName, width, height, board[][*height]))
          {
                
          }

//...
//function definition...

bool OpenBoard(std::string *boardFileName, int *width, int *height, int board[][100])

Arrays need to be declared with constants, not variables.

You can't declare arrays using sizes available at run-time.

Given that your function definition has a constant, how about

int board[100][100];
          if(OpenBoard(boardName, width, height, board))
          {
                
          }

//...
//function definition...

bool OpenBoard(std::string *boardFileName, int *width, int *height, int board[][100])

But since this is C++, how about std::vector< std::vector<int> > board;

Well i dont think arrays can be initialised with variables.

i think vectors are the suitable task for the job.

Thanks guys I really appreciate it! I've been puzzled for a few hours haha

commented: You're welcome :) +23
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.