Checking a NULL pointer before deleting is basically pointless. If the pointer is set to NULL, deleting the pointer does nothing. This may be a reason for checking for NULL pointers, and deleting a pointer that has been set to NULL may indicate a bug in the program.
The above is the detailed content of Why check for NULL pointer before deleting in C/C++?. For more information, please follow other related articles on the PHP Chinese website!