I have a following sturcture for creating linked list, how can I free the allocated memeory?
typedef struct linked_list {
struct linkedl_ist *number;
POINTER house;
} list;
typedef list *LIST;
typedef void pointer
i have following list
LIST l1;
l1 = some_function(pointer);
These l1 is constructed using some variables. This is a linked list data structure as i mentioned. How can I free the memory allocated for l1?
[EDIT]
l1 holds a memory of 8 byte.
l1doesn’t need to be freed. It’s on the stack. Return from the function you’re in and it will automatically go away. The way to free whatl1points to is the same as the way to free the rest of the elements of the list: walk the list (using->number) and free each element as you go.