Question: Suppose a dynamic variable were created as follows: char *p; p = new char; Assuming that the value of the pointer variable p has not
Suppose a dynamic variable were created as follows:
char *p;
p = new char;
Assuming that the value of the pointer variable p has not changed (so it still points to the same dynamic variable), how can you destroy this new dynamic variable and return the memory it uses to the freestore manager so that the memory can be reused to create other new dynamic variables?
Suppose your program contains code to create a dynamically allocated array as in question above , and suppose the pointer variable entry has not had its (pointer) value changed. Write code to destroy this dynamically allocated array and return the memory it uses to the freestore manager.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
