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


d. B and C

Computer Science & Information Technology

You might also like to view...

When a search is done with parallel arrays, the __________ of elements in one array must always correspond with the __________ of elements in the other parallel arrays.

Fill in the blank(s) with correct word

Computer Science & Information Technology

Briefly describe the kind of animations that you can construct using Rhino.

What will be an ideal response?

Computer Science & Information Technology

The first time you want to connect to a secured network, you are required to enter the correct _____.

A. decryption key B. user name and password C. password D. encryption key

Computer Science & Information Technology

A(n) causes an application to produce erroneous results.

a) logic error b) event c) assignment statement d) syntax error

Computer Science & Information Technology