You are viewing a single comment's thread. Return to all comments →
Hope this will work in c SinglyLinkedListNode *ptr,*tmp; tmp = (SinglyLinkedListNode *)malloc(sizeof(SinglyLinkedListNode)); tmp->data = data;
if(head==NULL){ head=tmp; tmp->next = NULL; return head; } else{ ptr=head; while(ptr->next!= NULL) ptr=ptr->next; ptr->next = tmp; tmp->next = NULL; } return head;
Seems like cookies are disabled on this browser, please enable them to open this website
Insert a Node at the Tail of a Linked List
You are viewing a single comment's thread. Return to all comments →
Hope this will work in c SinglyLinkedListNode *ptr,*tmp; tmp = (SinglyLinkedListNode *)malloc(sizeof(SinglyLinkedListNode)); tmp->data = data;