Chapter - 5: Classes in C++

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


D
Sections
4
Exercises

A

B

C

D

1

2

3

4

5

6

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[].


© 2020 Garbage Valuegarbage value logo