usage of free in double linked lists?
usage of free in double linked lists
can i free a pointer which i got through assignment of some other pointer
suppose p and q are pointers of same type then
after doing p=q;
is it necessary to use free(p) and free(q) or only one is enough
Thanks in advance
Re: usage of free in double linked lists?
You free the memory pointed to by the pointer, not the pointer itself. There is no magic connection between a pointer and the memory it points to, so
If you want to free the pointer itself then you need to make the variable of type pointer to pointer to thing, not just pointer to thing:
|All times are GMT +5.5. The time now is 20:54.|