#include<iostream>
#include<conio.h>
usingnamespace std;
void dynamicarray(int arrayy[3][5],int n){
int **arrayy= newint*[n];
for (int i=0; i < n; ++i){
int **arrayy=newint*[8];
for(int j=0;j<8;++j)
arrayy[i][j]=newint [8][1];//declaring an array like a chessboard
for(int x=0;x<8;x++){
for(int y=0;y<8;y++)
arrayy[x][y]=x*y;//set each element to value
}
cout<<"array indicates;\n";
for (int x=0;x<8; x++){
for(int y=0;y<8;y++)
// we can use mda[x][y] now
// now we must clean up
for (int i=0; i < n; ++i){
for(int j=0;j<n;++j)
{
delete[] arrayy[i];
delete[] arrayy;
getch();
}}}}}
int main()
{
int n=0;
int x,y;
cout << "Specify n: ";
cin >> n;
cout<<"["<<x<<"]["<<y<<"]="<<dynamicarrayy[x][y]<<" ";
cout<<"\n";
}
// first allocate the rows dynamically
int** dynamicArray = newint *[rows];
// then allocate the columns dynamically.
for( int i = 0 ; i < rows; i++)
dynamicArray[i] = newint[cols];
// delete them properly
for( int i = 0 ; i < rows; i++)
delete[] dynamicArray[i];
delete[] dynamicArray;