Other function, Node at the end of a List
Hi everybody,
I have another doubt about another function.
Sorry if this will be boring or silly d for anyone, but I began to study C language only two months ago.
The function is thought to insert a new node at the end of a list.
The function is named "suf_insert".
Code:
struct list{
float value;
struct list *next_ptr;
}
void suf_insert(struct list ** doublepointer, float value)
/*INPUT of the function:
-a pointer which points to a pointer which points to a record;
-a float.*/
while (*doublepointer != NULL) { /*while the pointer pointed by the doublepointer of the input si different from NULL*/
doublepointer = &((*doublepointer)->next_ptr);
/*I can't understand this line.
How can I make my double pointer "slide" from one record to another? What is happening here?*/
} pre_insert(ptrptr, value); /*here I use a known function which insert the node when I reach the end of the list*/
}
My double pointer at the beginning points to a pointer which point to the first node of my linked list.
I can't understand how it can slide from a node to another.
Moreover, I can't understand how it can point "automatically" to the part of the node which contain next_ptr.
I tried to study the theory, but I think I'm not understanding something about the pointer and the record (node).
Thanks to anyone who will be able to clear up my doubts!!