why not just create the array in main() and pass it as a parameter
int CreateBoard(int Board[9][9])
{
// all your code here
return 0;
}
int main()
{
int Board[9][9];
CreateBoard(Board);
return 0;
}
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
another vote for stl vectors!!
daviddoria
Posting Virtuoso
1,996 posts since Feb 2008
Reputation Points: 437
Solved Threads: 204
vectors are great for single dimension arrays. As you add more dimensions vectors become much more complicated than simple int arrays like Board. Here's an example of a 2d array of vectors
typedef vector<int> COLUMNS;
vector<COLUMNS> Board;
//or you can do this too
vector< vector<int> > Board;
The nice thing about the above is that the rows do not have to all contain the same number of columns, that is the number of columns can be different for each row.
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343