I am learning linked lists in C , and I don't understand these 2 lines:
struct LinkedList{
int data;
struct LinkedList *next;
};
typedef struct LinkedList *node; //1
node createNode(){ //2
node temp;
temp = (node)malloc(sizeof(struct LinkedList));
temp->next = NULL;
return temp;
}
In //1 What does it mean to assign a pointer as a name for the structure in typedef? and in //2 how can we have a function of the structure(node aka struct Linkedlist) ,as functions cannot be members of structures?