Answered step by step
Verified Expert Solution
Question
1 Approved Answer
(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
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