Why do we check for a NULL pointer before deleting in C/C++?


It is basically pointless to check for a NULL pointer before deleting. Deleting a pointer will do nothing if the pointer set to NULL. It might be the reason to check for the NULL pointer that deleting a pointer which is already set to NULL may indicate bugs in the program.

Updated on: 30-Jul-2019

347 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements