why we use double pointer struct Node** head here? can anyone explain with details
/* Given a reference (pointer to pointer) to the head of a DLL and an int, appends a new node at the end */
void append(struct Node** head_ref, int new_data)
{
struct Node* new_node = (struct Node*)malloc(sizeof(struct Node));
struct Node* last = *head_ref; /* used in while loop below*/
new_node->data = new_data;
/*This new node is going to be the last node, so make next of it as NULL*/
new_node->next = NULL;
/*node as head */
if (*head_ref == NULL)
{
new_node->prev = NULL;
*head_ref = new_node;
return;
}
while (last->next != NULL)
last = last->next;
last->next = new_node;
new_node->prev = last;
return;
}