Difference between freeing the pointer and assigning it to NULL;

Posted by Sanjeev on Stack Overflow See other posts from Stack Overflow or by Sanjeev
Published on 2010-03-12T06:00:12Z Indexed on 2010/03/12 6:07 UTC
Read the original article Hit count: 158

Filed under:
|
|

Could somebody tell me the difference between:

int *p;
p=(int*)malloc(10*sizeof(int));
free(p);

or

int *p;
p=(int*)malloc(10*sizeof(int));
p=NULL;

© Stack Overflow or respective owner

Related posts about c

    Related posts about pointer