You are viewing a single comment's thread. Return to all comments →
c language
SinglyLinkedListNode* deleteNode(SinglyLinkedListNode* llist, int position) { int count=0; if(llist==NULL){ return NULL; } if(position==0){ return llist->next; } SinglyLinkedListNode* temp=llist; SinglyLinkedListNode* prev=NULL; while (temp!=NULL) { if(count==position){ prev->next=temp->next; free(temp); } count++; prev=temp; temp=temp->next; } return llist; }
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 language