Question: What is wrong with the code snippet below? void do _ it ( ) { int * num 1 = new int [ 1 0

What is wrong with the code snippet below?
void do_it()
{
int* num1= new int[10];
int* num2= new int[20];
num1[0]=100;
num2[0]= num1[0];
num1= num2;
// more important stuff here
delete[] num2;
}
Group of answer choices
num2 cannot be assigned to num1
The memory that num2 points to originally is never released.
The memory that num1 points to originally is never released.
There is no problem with this code snippet.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!