Indeed, I have found a lot of questions similar to mine, but none of them seems to be as silly as my obstacle to understand the basis of the insertion in a linked list in C.
typedef struct LList {
int value;
struct LList *next_list_id;
} LList;z
Given example code for insertion after a specified element (code from my lecture):
void insert_after(LList *orig, int element) {
LList *help;
help = (LList*)malloc(sizeof(LList));
help->next_list_id = orig->next_list_id;
help->value = element;
orig->next_list_id = help;
}
What I do not understand is something like:
help->next_list_id
In my understanding, help
is a pointer to a structure, not a structure itself. How can we use ->
operator for a pointer, if it is a pointer to a structure, not a structure?