Space in program

Can we free up space(like space of array) at the end of the program?

hello @govilayush

u can free all dynmically allocated memory at the end of the program

So no array right? Only for linked list or other dynamic allocation.

we can free array as well but for that we need to dynamically allocate memory to array.

ex->
int n;
cin>>n;
int *arr=new int [n]; // dynamically creating array

now to free it
delete []arr;

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.