typedef? int? size _ t;
typedef? struct? Node? Node; The first example gives the built-in type int an alias size _ t, and the second example gives the struct Node an alias Node. Here you see two common situations of typedef. The first example is used to provide a more specific alias for a generic type, which usually increases the readability of the code. The second example is used to simplify the complexity of code. Whenever you need to declare a structural Node variable, you can use Node directly.
Your example
typedef? struct? Node? {
struct? Library? Data;
struct? Node? * Next;
}? Node? *? Link; Just a relatively compact way of writing, which is equivalent to the following way of writing:
typedef? struct? Node? Node? *? Link;
struct? Node? {
struct? Library? Data;
Link? Next; ? //? Node? *? Next;
Note that I put typedef before the definition of structural nodes (this is the idiom of C language). Its advantage is that the C compiler will see the alias definition first, so I can already use its alias link or node to declare variables or pointers in the definition of structural nodes. You can put typedef after the definition of the structure node and write.
struct? Node? {
struct? Library? Data;
struct? Node? *? Next;
}
typedef? struct? Node? Node? *? Link; But you can't use alias nodes or links in the definition of nodes. Therefore, you will see that the next statement uses struct node *.
Finally,
typedef? struct? Node? Node? *? Link; Is still a compact writing, equivalent to:
typedef? struct? Node? Node;
typedef? struct? Node? *? Link; The first statement provides an alias node for the structure node (the structure node itself). The second statement gives struct node * (a pointer to the node structure) an alias link.