Is the deallocation correct?

#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;
}

@sagar_aggarwal hey no need to write

delete arr

Thanks :slight_smile:

I am not able to mark as resolved. everytime i refresh it again reopens

@sagar_aggarwal there is a mark as resolved button over there

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.