Easy C Programming For each of the dynamic variable declarat
Easy C++ Programming
For each of the dynamic variable declarations listed on the left, provide the necessary delete statement that would destroy this dynamic variable and return the memory it uses to the heap so that other variables may use this memory. Consider the following code. Which of the variables should be deleted when the program ends? Consider the following code. What is the output generated by this program? Sample Code d2 = 10.0; pd1 = new doublet (22.5); pd2 = &d2; *pd1 = *pd2;Solution
delete I;
delete s;
delete[] array;
delete[] darray;
pI - NO
pJ - NO
newInt - YES
pInt - YES
Considering the above code fragment there will be compilation error at below line
if(*pd == *pd2) //because pd pointer variable is not declare .
Considering it the printing mistake and if it was suppose to be *pd1 below is the output generated by the code :
10
5
