what is the effect of passing of NULL pointer(0) to delete pointer ? pls ans me | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

what is the effect of passing of NULL pointer(0) to delete pointer ? pls ans me

8th Aug 2016, 6:06 PM
Santhosha S R
Santhosha  S R - avatar
3 Answers
+ 2
@Srinivas: It's the other way round. First you can delete as the memory the pointer points to is still allocated, then you assign null to the pointer. As the deletion of a null pointer does not lead to any error (no segmentation fault or memory access violation) this is a way to make sure any additional deletes on the same pointer do not produce above mentioned problems.
8th Aug 2016, 9:27 PM
Stefan
Stefan - avatar
0
i don't no what you are expected to tell.. i didn't understand this.. thnx
8th Aug 2016, 6:42 PM
Santhosha S R
Santhosha  S R - avatar
0
@Srinivas: No prob. It's my pleasure. :-)
8th Aug 2016, 9:36 PM
Stefan
Stefan - avatar