+ 9
free dynamic allocation
how to know if this memory is freed in c ex: int *p=malloc(sizeof(int)); free(p); after that how to know if this memory is freed
2 Answers
+ 6
its definitely free, but if you have a doubt, just use an if statement to check if the value of the pointer is NULL then the memory is freed, i guess you know how to do that
edit: am not sure they is a way to check this, but after freeing the pointer you can assign the pointer to NULL
+ 2
p will not be null after free call because I pass p by value so p will not affected