We are given a task and a struct of linked list:
typedef struct dlistint_s
{
int n;
struct dlistint_s *prev;
struct dlistint_s *next;
} dlistint_
Because if you are using dlistint_t *head
variable instead of using dlistint_t **head
variable in function parameter then, changes made in variable head
in function dlistint_t *add_dnodeint(dlistint_t **head, const int n);
will be local to this method. Since you are using Node*
so changes done in variable head
is local to that function. If you want to reflect these changes even after function call(which you obviously wants to) then use dlistint_t **head
.