We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
The memory allocated to a is never freed. It will cause memory leak.
The memory allocated on the line:
long int *a=new long intN+1;
Memory allocated to long int a in never deleted in the main(). It will cause memory leak.
Try executing the same program with valgrind, you will find the memory leak.
Edit: Memory leak explanation.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Array Manipulation
You are viewing a single comment's thread. Return to all comments →
The memory allocated to a is never freed. It will cause memory leak.
The memory allocated on the line:
long int *a=new long intN+1;
Memory allocated to long int a in never deleted in the main(). It will cause memory leak. Try executing the same program with valgrind, you will find the memory leak.
Edit: Memory leak explanation.