cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
simple 2D array question
simple 2D array question
Oct 18, 2012 at 1:44am UTC
arikh
(2)
I want to declare a 2D array whose number of rows is stored in a variable. The compiler does not allow me to do that. I was wondering if anyone could give me any suggestion.
....
line = Func(filename);
int array[line][5];
.....
Oct 18, 2012 at 2:13am UTC
pogrady
(677)
You can, but you need to declare a dynamic array:
int* a = new int[line][5];
Oct 18, 2012 at 2:28am UTC
arikh
(2)
that also doesnt work in VS2010. It gives an error
Topic archived. No new replies allowed.