I’m confused why the following C++ code can compile. Why does a call to delete the method of 0 not produce any error?!
int *arr = NULL; // or if I use 0, it's the same thing
delete arr;
I did try to run it, and it did not give me any error at all…
The C++ language guarantees that delete p will do nothing if p is equal to
NULL.
For more info, check out Section 16.8,9 here: