Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/Chapter_03_Linked_Lists/DoublyLinkedList.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ void delete(struct DLLNode **head, int position) {
temp = temp->next;
k++;
}
if(k < position-1){
if(k < position){

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think @Mishra-Sagar ,
if( k != position) is also valid . What do you say?

printf("Desired position does not exist\n");
return;
}
Expand Down Expand Up @@ -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;
}