2

I have one pointer which is NULL, but if NULL is its value, I think that is still all right to free the memory allocated for it.

Is this true?

letsintegreat
  • 3,328
  • 4
  • 18
  • 39
Alex
  • 31
  • 7
  • No operation is performed. – danglingpointer May 01 '18 at 08:47
  • It is legal and can make sense. If you initialise data properly you can `free(.)` pointers that may be `NULL`. If you recycle objects you may need to re-initialise them. `free(p); p=NULL;` is a common practice. – Persixty May 01 '18 at 08:49

0 Answers0