While studying data structure I came up with the Linked List section, particularly the head node and tail node section.
From what I was read an taught, many users of C tend to use only Node *head;
.
But there was a part where using the following code was recommended to be used:
typedef structure _node node;
struct _node{
int data;
Node *next;
}
typedef structure list {
Node *head;
Node *tail;
int size;
} List;
As a person who has just started studying C and data structure, I found it more understandable when writing it like this, but since the teacher told us that most people do not write it like this but just use Node *head
, I was curious on knowing what others actually used in reality.
Do developers and C users really use just one line, or do they use it like the code written above?