Given the following declaration:
Node declaration:
struct LLNode{
int data;
struct LLNode *next;
}
typedef struct LLNode Node;
following are the functions to insert a node at start of Linked List. Assume "head"is pointer to first Node of the Linked List.
"Head_ref" is a pointer to "head".
Implementation A
void insert(Node *head,int data)
{
Node *NewNode= (Node *)malloc(sizeof(Node));
NewNode->data=data;
NewNode->next=head;
head=NewNode;
}
Implementation B
void insert(Node **head_ref,int data)
{
Node *NewNode= (Node *)malloc(sizeof(Node));
NewNode->data=data;
NewNode->next=*(head_ref);
*(head_ref)=NewNode;
}
Which Of the following is correct Implementation
A)ONLY A
B)ONLY B
C)both
D)None