#include<iostream>
using namespace std;
int main()
{ int r,c;
cin>>r>>c;
//allocation
int ** arr;
arr= new int*[r];
for (int i = 0; i < r; i++)
{
arr[i]=new int[c];
}
// deallocation
for (int i = 0; i < r; i++)
{
delete [] arr[i];
}
delete []arr;
delete arr;
return 0;
}
Is the deallocation correct?
Thanks
I am not able to mark as resolved. everytime i refresh it again reopens
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.