No clear (to me) material in the web. Hence I am posting here.
I must allocate memory for a matrix (2D array) of strings during runtime. Here is my code:
string *matrix; //must become matrix[r][nc]
int r, nc;
...
matrix = new string[r][nc];
where r and nc are calculated during runtime.
The compiler is not happy at all with the allocation (new) statement.
But is very happy if I limit matrix to be 1D array, like matrix = new string[r];
What is the correct syntax for the 2D allocation?
Thanks.
Last edited on
Negative. Does not work and I believe ** means "pointer to pointers".
Thanks to everyone! Very much appreciated.