I've seen various implementations online were some only create a node struct for their linked lists, while others create both a list struct and a node struct and thus I was wondering what is best practice.
Example of list and node_struct implemenation:
typedef struct listnode listnode_t;
struct listnode {
listnode_t *next;
listnode_t *prev;
void *elem;
};
struct list {
listnode_t *head;
listnode_t *tail;
int size;
};
Example of node struct only implementation:
typedef struct node node_t;
struct node {
int data;
node_t *next;
};
node_t *head;
node_t *tail;