Question: Problem 3: Delete All the Things Write delete statements that correctly delete the following dynamically allocated entities. Hint: draw out the memory layout on scratch
Problem 3: Delete All the Things Write delete statements that correctly delete the following dynamically allocated entities. Hint: draw out the memory layout on scratch paper. int *p1 = new int[10]; int *p2[15]; for (int i = 0; i < 15; i++) p2[i] = new int[5]; int **p3 = new int*[5]; for (int i = 0; i < 5; i++) p3[i] = new int; int *p4 = new int; int *temp = p4; p4 = p1; p1 = temp;
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
