answersLogoWhite

0

Are you talking about freeing dynamically allocated memory in C/C++? free() is a function that you use to release dynamically (i.e. at run-time) created memory in C, using malloc() or alloc() or such other functions. In the same way, delete() is a function that is used in C++ to release memory created at run-time using the function new(). (Note that you can still use malloc and other C functions in your C++ code, but it is not considered a good programming habit. Moreover, new() is easier to use and more flexible, once you get the hang of it.

If this is not what you had in mind, then I do not know if this will be of any help to you.

addition:

-new is constructor of which delete is destructor so use in pairs always.. similarly use malloc with free..

extra note:

- no type cast required for new , whereas malloc, free may require it.

- new returns exception whereas malloc returns NULL when memory issue.

User Avatar

Wiki User

14y ago

What else can I help you with?