You are viewing a single comment's thread. Return to all comments →
C code
SinglyLinkedListNode* deleteNode(SinglyLinkedListNode* head, int position) { SinglyLinkedListNode *temp1, *temp2; temp1=temp2=head; if(position==0) { head=temp1->next; free(temp1); } else { for(int i=0;i<position-1;i++) { temp1=temp1->next; } temp2=temp1->next; temp1->next=temp2->next; free(temp2); } return head; }
Seems like cookies are disabled on this browser, please enable them to open this website
Delete a Node
You are viewing a single comment's thread. Return to all comments →
C code