cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
General C++ Programming
Dynamically allocating a 2D array
Dynamically allocating a 2D array
Aug 11, 2011 at 12:50am UTC
vasiqshair
(51)
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];
Aug 11, 2011 at 12:55am UTC
quirkyusername
(792)
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
Aug 11, 2011 at 12:56am UTC
Topic archived. No new replies allowed.