Error C2087 & Error C2133 Please

Goal:
Read contents from a file and use as the size of a 2d array.

Problem:
C2087: Line 27 : "a1" : missing subscript
C2133: Line 27 : "a1" : unknown size

1
2
3
4
5
6
int rows;
int columns;
ifstream fObject("inputdata.dat");
fObject>>rows;
fObject>>columns;
char a1[rows][columns];


I am not sure why this is occuring, or if there is a better way to do it.
you can't declare arrays with variable subscripts. Look into vectors. http://www.cplusplus.com/reference/vector/vector/
Topic archived. No new replies allowed.