User Defined Matrices

For my program I need to get a 2D array or matrix to have a user defined size. Which means that 2 variables will essentially store inputs from user and then the matrix size needs to be based on those variables.

Someone gave me a hint that it involves pointers but I can't just get it to work. Help would be highly appreciated.
http://www.cplusplus.com/forum/articles/17108/
While the article isn't exactly meant for that, it does show several ways to create a dynamic 2d array.
check this template out
template <class T>
T * new2D(T dummy, int row ,int col)
{
T **p;
p=new T* [row];
for(int i=0;i<col;i++) p[i]=new T [col];
return p;
}
now you can use
a=new2D(10,2,3);
a[1][1]=8;
Topic archived. No new replies allowed.