Solved

Suppose That a Function Dynamically Allocates a Block of Memory

Question 33

Multiple Choice

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 the above

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions

Unlock this Answer For Free Now!

View this answer and more for free by performing one of the following actions

qr-code

Scan the QR code to install the App and get 2 free unlocks

upload documents

Unlock quizzes for free by uploading documents