Question: (C++) Identify any problem with the following code that uses a dynamic array (assume magazineSize has been properly set). You may select one or more

(C++) Identify any problem with the following code that uses a dynamic array (assume magazineSize has been properly set). You may select one or more answers.

string* articles = new string[magazineSize]; string* textP; for (textP = articles; textP < articles + magazineSize; textP++) cout << *textP << endl; delete[] textP; textP = NULL;

Group of answer choices

a. Leaves dangling pointer (pointer retains address after no longer used)

b. Creates memory leak (array not properly deallocated)

c. Dereferences a NULL pointer

d. Accesses memory outside of array

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!