struct address { char name[40]; char street[40]; struct address *next; } info; void Add(struct address *i, struct address **last) { if(!*last) *last = i; else (*last)->next = i; i->next = NULL; *last = i; } I study singly linked lists. I have difficulty with the function to add an item to the end of the list. As parameters, it is passed a pointer to an address type structure containing the new entry, and a pointer to the last element of the list. I'm not good at pointers and I don't understand why I need a pointer to a pointer in the function parameters?
For myself, I could not decipher only what this action means: if the last element is not zero, then assign the last value to the last one, otherwise (*last)->next = i; . Then we give the next element a zero value to initialize it as, I understood, and for some reason, the last line. Help please understand