Here is a basic program for insertion at the beginning of a LL.
I have a fair idea of double pointers. Please will you tell me what exactly is the need of using a double pointer to head here in this code? node * head would have sufficed I believe.Code:void insert( node **head, int item) { node *ptr; ptr=(node *) malloc(sizeof(node)); ptr->info= item; if( *head == NULL) ptr->next = NULL; else ->ptr->next = *head; *head = ptr; }