Dynamically allocating a 2D array

When you know the number of columns (3 in this case). The rows will be entered by the user. Here's how I had it, but apparently this is the wrong approach because I got a ton of errors with this statement

int ReferencedPages = new int [ROWS][COLUMNS];
You've almost got it, you dynamically assign memory through pointers, like so:

 
int* ReferencedPages = new int [ROWS][COLUMNS];


ReferencedPages is a pointer to an int here
Last edited on
Topic archived. No new replies allowed.