The code for creating and inserting nodes in linked list (refer the link for code), we have used new to allocate memory dynamically but we haven’t freed the memory using delete. Won’t it cause a memory leak?
Do we not need to use 'delete' allocated memory in linked lists?
Yes @vaasugupta01
we should have to delete the nodes to free the memory
it is necessary to avoid memory leakage
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.