Question: Consider the following code segment. Provide the appropriate delete statements that will deallocate all dynamically allocated memory. int *p1 = new int[10]; int **p2

Consider the following code segment. Provide the appropriate delete statements that will deallocate all dynamically allocated memory. int *p1 = new int[10]; int **p2 = new int*[5]; for (int i = 0; i < 5; i++) p2[i] = new int; int *p3[15]; for (int i = 0; i < 15; i++) p3[i] = new int[5]; int *p4 = new int; int *temp = p4; p4 = p1; p1 = temp;
Step by Step Solution
3.43 Rating (150 Votes )
There are 3 Steps involved in it
To deallocate the memory that has been dynamically allocated in the provided code segment we need to ... View full answer
Get step-by-step solutions from verified subject matter experts
