Chapter - 5: Classes in C++

What is the difference between in the following two statements? delete a; delete []a;


D
Sections
4
Exercises

In the first statement, it deletes the variable a and if a is an array, so it deletes the first element of the array or it corrupts the heap pool. In the second statement, it deletes the whole array a[].


© 2021 Garbage Valuegarbage value logo