You are viewing a single comment's thread. Return to all comments →
In c language
SinglyLinkedListNode* insertNodeAtPosition(SinglyLinkedListNode* llist, int data, int position) { struct Node *ptr = (struct Node *)malloc(sizeof(struct Node )); struct Node * p = llist; int i = 0;
while (i!=position-1) { p = p->next; i++; } ptr->data=data; ptr->next = p->next; p->next = ptr; return llist;
}
Seems like cookies are disabled on this browser, please enable them to open this website
Insert a node at a specific position in a linked list
You are viewing a single comment's thread. Return to all comments →
In c language
SinglyLinkedListNode* insertNodeAtPosition(SinglyLinkedListNode* llist, int data, int position) { struct Node *ptr = (struct Node *)malloc(sizeof(struct Node )); struct Node * p = llist; int i = 0;
}