I am learning c++
and a found an example on pointers and arrays:
..
int n;
cout << "Give an integer: \n" ;
cin >>n;
int *a;
a = new int[n];
..
My question is if it is possible to create a 2 dimensional array with pointers in order to create a board. I've tried:
... int h, w;
cout << "Give the high of the board \n";
cin >> h;
cout << "Give the width of the board \n";
cin >> l;
int *a;
a = new int[h][w];
...
But doing it like this gives me a lot of errors. What I'am trying to do is create a board of h by w with dynamic memory.
Does anybody knows how to do this?
Thanks anyway