What is a NULL value

Posted by Adi on Stack Overflow See other posts from Stack Overflow or by Adi
Published on 2010-04-02T06:07:45Z Indexed on 2010/04/02 6:13 UTC
Read the original article Hit count: 284

Filed under:

I am wondering , what exactly is stored in the memory when we say a particular variable pointer to be NULL. suppose I have a structure, say

typdef struct MEM_LIST MEM_INSTANCE;
struct MEM_LIST
{
      char *start_addr;
      int size;
      MEM_INSTANCE *next;
};
MEM_INSTANCE *front;

front = (MEM_INSTANCE*)malloc(sizeof(MEM_INSTANCE*));

-1) If I make front=NULL. What will be the value which actually gets stored in the different fields of the front, say front->size ,front->start_addr. Is it 0 or something else. I have limited knowledge in this NULL thing.
-2) If I do a free(front); It frees the memory which is pointed out by front. So what exactly free means here, does it make it NULL or make it all 0.
-3) What can be a good strategy to deal with initialization of pointers and freeing them .

Thanks in advance

© Stack Overflow or respective owner

Related posts about null