You are viewing a single comment's thread. Return to all comments →
In C
SinglyLinkedListNode* insertNodeAtTail(SinglyLinkedListNode* head, int data) { SinglyLinkedListNode *ptr=(struct node*)malloc(sizeof(SinglyLinkedListNode)); SinglyLinkedListNode *temp; ptr->data=data; temp=head; if(head==NULL){ head=ptr; return head; } else{ while(temp->next!=NULL) temp=temp->next; } temp->next=ptr; ptr->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 →
In C