Generalized Linked List(1)

When I write about Generalized Linked List, I guess you already knew about Linked List.
When you study about linked list, maybe you saw below structure.
typedef struct
{
char name[20];
int age;
} STUDENT;
typedef struct _node
{
STUDENT student;
struct _node *next;
struct _node *prev;
} NODE;
If you use above structure, you just can use above list for STUDENT structure.
If you can remove STUDENT from NODE, you can use the list for any type of data. I knew conculusion
typedef struct _node
{
struct _node *next;
struct _node *prev;
} NODE;
typedef struct
{
char name[20];
int age;
NODE link;
} STUDENT;
typedef struct
{
char name[20];
int age;
NODE link;
} FRIEND;
If you just remove STUDENT from NODE and add NODE to STUDENT as a link, you can use the node for any type of data. That is very simple idea but that is not esay to thinking.
In this case, you don't need to use STUDEN, FRIEND for makeing list.
If you use NODE, you can make a list very simply but you must know the method for measuring adress of data structure like FRIEND or STUDENT using address of link that is declared in data structure.
So, I give you macro function below.
/*
*This sentence means that measuring size of address from TYPE(if ddress is 0) to LINK. Because you used "&".
*(unsigned int)&((TYPE*)0)->LINK)
*
*This sentence is very simple, NODE is address of link(data structure member). this is real data.
*(char*)NODE
*/
#define list_entry(NODE,TYPE,LINK) ((TYPE*)((char*)NODE-(unsigned int)&((TYPE*)0)->LINK))
I think you don't understand what is that meaning exactly so, I'm going to give you example with function in Generalized Linked List(2).