There are several ways to define a 2D array in C++ and STL without memory manipulation, and the following codes illustrate two different methods:
int main ()
{
One very efficient method to define arrays is dynamic allocation, using the new and delete operators. Here is an example:
int **arr=new int*[ROW];
for( int i=0; i|
The big advantage of this approach is that when you don't need any more the memory that the array uses, you can easily delete it. Here is an example of deleting a 2D array:
for( int i=0; i|