Question: Suppose that a function dynamically allocates a block of memory with a local pointer variable p pointing to the allocated block. Suppose further that there
Suppose that a function dynamically allocates a block of memory with a local pointer variable p pointing to the allocated block. Suppose further that there are no other pointers referencing that block of memory, and the function returns without doing a delete on p. Then
| A. | the pointer p becomes a dangling pointer. | |
| B. the compiler will automatically deallocate the memory pointed to by p. | ||
| C. the program will suffer from memory leaks. | ||
| D. the returning function will throw the bad_alloc exception. | ||
| E. None of these |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
