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)
ptr=(node *) malloc(sizeof(node));
if( *head == NULL)
ptr->next = NULL;
->ptr->next = *head;
*head = ptr;