Understanding concept of free
Tried the following code :

        
    #include<stdio.h>
    int main()
    {
        
            int *p,*q;
            p = (int *)malloc(sizeof(int));
            *p =10;
            q = p;
            printf("%u \n",p);
            printf("%u \n",q);
            free(p);
            printf("%u \n",p);
            return 0;
    }



The output got is as follows :

    [root@lnxdesk Tazim]# ./a.out
    154804232
    154804232
    154804232


Why is that address inside p is still printed even if
I have done free(p);
What has free(p) done than ? 
Want to understand the concept of free/malloc clearly.

Any Help will be valuable,

Thanks in advance,
Tazim

Understanding concept of free
===

Tried the following code :

        
    #include<stdio.h>
    int main()
    {
        
            int *p,*q;
            p = (int *)malloc(sizeof(int));
            *p =10;
            q = p;
            printf("%u \n",p);
            printf("%u \n",q);
            free(p);
            printf("%u \n",p);
            return 0;
    }



The output got is as follows :

    [root@lnxdesk Tazim]# ./a.out
    154804232
    154804232
    154804232


Why is that address inside p is still printed even if
I have done free(p);
What has free(p) done than ? 
Want to understand the concept of free/malloc clearly.

Any Help will be valuable,

Thanks in advance,
Tazim
