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 is a de-facto standard in C and C++ languages (and not only in them) that resource deallocation routines must accept null-pointer arguments and simply do nothing. Actually, it is a rather convenent convention. So, the real question here: why does it surprize you? What makes you think that it should produce an error? Moreover, what makes you think that it should fail to compile???
BTW, your question, the way it is stated, doesn't seem to make much sense, since your code actually cannot compile. The supposed pointer declaration lacks a type, which will make any compiler to issue a diagnostic message.