2076 8

Object Oriented Programming20765 marksDynamic Memory Allocation with new and delete

What is use of new and delete operators? Illustrate with example. What are advantages of new over malloc.

What is use of new and delete operators? Illustrate with example. What are advantages of new over malloc. [5]

The new operator is used to dynamically allocate memory at runtime from the heap (free store). It allocates memory for a variable or object and returns a pointer to it. If allocation fails, it throws a badalloc exception. Syntax: The delete operator is used to free/deallocate memory that was prev...

Up nextHow can define catch statement that can catch any type of exception? Illustrate the use of