Solved

What Is Wrong with the Following Code Fragment

Question 34

Multiple Choice

What is wrong with the following code fragment?
Int *p1, *p2;
P1 = new int;
P2 = new int;
*p1=11;
*p2=0;
P2=p1;
Cout << *p1 <<" " << *p2 << endl;
Delete p1;
Delete p2;


A) nothing
B) p1 and p2 both have the same value, so the delete p2 will cause an error
C) You have a memory leak.
D) B and C

Correct Answer:

verifed

Verified

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

Related Questions