To avoid erroneous use of unassigned pointers all pointers should be set to NULL when declared. They should be set to NULL again when the memory they point to is freed.
The language specification does not require the compiler to do this.
If this is done then using the unassigned pointer will throw an exception.
For example #1 should be
struct *abc_ptr = NULL;
#2 should be
int *p = new int;
delete p;
p = NULL;
and #5 should be
void x()
{
abc *abc_ptr = new abc[100];
delete [] abc_ptr;
abc_ptr = NULL;
}
In all the other examples the pointer should either point to valid memory or be set to NULL.
If the pointer is not set to NULL it could have any value and subsequent use of that pointer will have unpredictable results.
The is the cause of many subtle bugs.