Memory leak in C++ and How to avoid it?

Memory leakage in C++ occurs when we allocates memory by using new keyword and forgets to deallocate the memory by using delete() function or delete[] operator.


This is a companion discussion topic for the original entry at http://iq.opengenus.org/memory-leak-in-cpp-and-how-to-avoid-it/