struct LinkedList
{
int data;
struct LinkedList *next;
};
In the code, within the definition of struct LinkedList there is
What you talk about are recursive data structrues and the question is how to let a data structure reference itself.
In C this can be done by declaring a pointer to itself in the definition of the data structure, "self" meaning a thing of its own type.
Note that when you write the expression, the data structure is not yet complete. Therefore it is not possible to let a data structue contain an occurence of itself, for once because the definition is not yet completely known and for two because the data strutcure would be never ending containing an occurrence of itself, itself,...
But you can declare a pointer to itself. The compiler now only allocates storage for the pointer and if you later assign/dereference the pointer it knows the storage pointed to contains an occurrence of itself. That is what you do in your example.