+ 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
Hot today
Python — File Handling
0 Votes
Help me solve this (using loop)
2 Votes
What is wrong? Error on test.
1 Votes
Help me wiht python
1 Votes
Question is write a c program to print prime numbers up to n and print the largest number in array.
1 Votes
Help me
0 Votes