Question: What is wrong with this sequence of statements? int* p = new int[10]; p[10] = 5; delete[] p; The answer in my book is:The access
What is wrong with this sequence of statements?
int* p = new int[10];
p[10] = 5;
delete[] p;
The answer in my book is:The access p[10] is illegal; the returned array has elements with index 0 ... 9.
but i don't understand this explanation. Please explain why this is incorrect in detail.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
