array bound is not an integer constant

hi, i have to input and then display a matrix using functions. the problem is that i have to enter the bounds of the matrix from the user.i tried this by two ways but none of them worked. 1-i made the array global but declaring a[m][n] in global variables ,i got this error " array bound is not an integer constant"
so i thought of entering the bounds of the array in main fucntion and then passing the array to the display function, which made me define the function as
void dispmatrix(int a[][n],int m,int n)

but this also gives me the same error
You cannot declare an array with variable size unless you use the new keyword.
See: http://www.cplusplus.com/doc/tutorial/dynamic.html
It may be better to use a vector which in many ways is similar to an array but does not need its size specified at compile time. It keeps track of its element number as incremented and decremented. The <vector> header file is required.
See http://www.cplusplus.com/reference/stl/ for docs on the various standard containers (which include vector).
Topic archived. No new replies allowed.