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
You can delete a NULL pointer without problem, and the error you may/can have won't be at compilation time but at runtime.
int *ptr_A = &a; ptr_A = NULL; delete ptr_A;
Usually it's convenient to do :
... delete ptr; ptr = NULL;