MCQOPTIONS
Saved Bookmarks
| 1. |
Consider the following sequence of operations:(i) Pointer p1 is set to point at a new heap-dynamic variable.(ii) Pointer p2 is assigned p1's value.(iii) The heap dynamic variable pointed to by p1 is explicitly de-allocated, but p2 is not changed by the operation.This situation leads to which of the following: |
| A. | p1 becomes a dangling pointer |
| B. | p2 becomes a dangling pointer |
| C. | Both p1 and p2 are now dangling pointers |
| D. | Neither p1 nor p2 is now a dangling pointer |
| Answer» C. Both p1 and p2 are now dangling pointers | |