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,168
  • 4
  • 17
  • 38
Alex
  • 31
  • 6
  • 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