I'm trying to write a linked list with structures using gcc. I have a node structure:
Code:
struct Node
{
void *value;
Node *next;
Node *prev;
};
value is a pointer to some data in memory that is allocated using malloc.
Each node is created using malloc.
When I destroy the list i call free on every Node pointer, but the memory that value was pointing to is still there, right?
If so, is there some sort of destructor I can use with structs?
...The goal is to separate the list-specific functions as much as possible and still be able to use the list for different types of data.