Which is the best way to implement a stack and a singly-linked-list? Should i have two structs in which the first will contain the structure of a node ( value(s) , pointer ) and the other one the important nodes ( top or head,tail and the size if needed) or should i use only the node struct?
Here is what i mean :
Case 1 :
typedef struct node {
int value;
struct node *next;
} Node;
Case 2 (Stack) :
typedef struct node {
int value;
struct node *next;
} Node;
typedef struct stack {
Node *top;
/* int size; */
} Stack;
Case 2 (sll) :
typedef struct node {
int value;
struct node *next;
} Node;
typedef struct list {
Node *head, *tail;
/* int len; */
} List;