Now that we are familiar with the struct type, we use it to implement a linked list. A linked list can be thought of as an array that's been blown apart and, since the elements are no longer contiguous in memory, we must explicitly chain (link) them together via explicitly mallloc'd pointers.
Notice in our code sample below that we use a slightly different form of typedef to declare our list element struct. This is needed because in our list element struct declaration we make a (self-)reference to our own struct! As you can see, C allows one struct to contain instances of other structs (or pointers to other structs or itself). But, for obvious reasons, a struct cannot contain a variable of its own type, only a pointer to its own type. Why? If we had declared a variable of our own type in the struct, the compiler would be unable to resolve the symbol, due to an infinite recursion of definition. Similarly, two different struct types cannot contain instances of each other as resolution of the final types would require an infinite mutual recursion.
Here is an example of struct composition in the context of a Linked List:
Let's look at the code and make sure we understand what's going on in all those functions. We'll write a few of our own as well. Here's where we ended up: