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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started