We deallocate the memory using free(ptr) even then why is there memory leak?please explain in detail
Doubt in Q4 of Mcq
because before deallocating the memory you changed ptr=NULL, so the address of allocated memory is lost and free(ptr) is equivalent to free(NULL) which does’nt do any things
1 Like