Explain why you cannot use a range-based for loop on dynamic arrays. (9) What is wrong with the following code? (9) double *p;                   //Line 1 p = new double[5];           //Line 2 for (int...


Explain why you cannot use a range-based for loop on dynamic arrays. (9)


What is wrong with the following code? (9)


double *p;                   //Line 1


p = new double[5];           //Line 2


for (int i = 0; i <>


p[i] = pow(i, 2.0);     //Line 4


for (auto x: p)              //Line 5


 cout <><>


cout <>


Explain the difference between a shallow copy and a deep copy of data. (11)




May 18, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here