Instead of: int board[4][4];
Replace with: int** board;
Now we can dynamically allocate space for the 2D board array.
In set_board(), we need to do the dynamic allocation like so:
// First allocate for the first dimension
board = new int*[height];
// Now allocate for the second dimension
for( int i = 0; i < height; i++ ) {
board[i] = new int[width];
}
Reputation Points: 33
Solved Threads: 18
Junior Poster in Training
Offline 77 posts
since Aug 2008