←
Top
/
Answer-21D-3
Answer to Question 21D-3
Variables
p
and
q
point to the same place. When statement
delete p;
is performed, both
p
and
q
become dangling pointers. Statement
printf
("*q = %i\n", *q);
uses dangling pointer
q
. Statement
delete q;
deletes the memory pointed to by
q
a second time
That can ruin the HM.