I am trying to initialized 2D array of string in c++.
std::string A = new std::string [m+1][n+1]
But this is giving me error as array size in new-expression must be constant.
I am trying to initialized 2D array of string in c++.
std::string A = new std::string [m+1][n+1]
But this is giving me error as array size in new-expression must be constant.
You could do it the C-Style String way...
char ** array = new char*[10];
for (int i = 0; i < 10; ++i)
{
array[i] = new char[100];
}
Then you just delete it in the opposite order you created it when done.
Using the STL is probably a good choice if you need to be safe and modern.