diff --git a/src/Chapter_03_Linked_Lists/DoublyLinkedList.c b/src/Chapter_03_Linked_Lists/DoublyLinkedList.c index fb3e007..a266587 100644 --- a/src/Chapter_03_Linked_Lists/DoublyLinkedList.c +++ b/src/Chapter_03_Linked_Lists/DoublyLinkedList.c @@ -180,7 +180,7 @@ void delete(struct DLLNode **head, int position) { temp = temp->next; k++; } - if(k < position-1){ + if(k < position){ printf("Desired position does not exist\n"); return; } @@ -234,5 +234,9 @@ int main(){ printf("List length is %d \n",length(head)); printList(head); printf("\n"); + delete(&head, 6); + printf("List length is %d \n",length(head)); + printList(head); + printf("\n"); return 0; }