#include <iostream>
using namespace std;
int main() {
int row,col;
int **ptr;
cout<<"enter Rows : ";
cin>>row;
cout<<"enter Cols : ";
cin>>col;
ptr= new int*[row];
for (int i=0;i<row;i++) // 2d array dynamically
{
ptr[i]= new int[col];
}
for (int i=0;i<row;i++) // delete 2d array
{
delete [] ptr[i];
}
delete [] ptr;
system("pause");
return 0;
}
No comments:
Post a Comment