From 16aa68d3288faffb14e8796123816b40cf728a03 Mon Sep 17 00:00:00 2001 From: Mohammed Saqib B <112095939+MohammedSaqib12@users.noreply.github.com> Date: Sun, 1 Oct 2023 20:11:19 +0530 Subject: [PATCH] Update doubly-linked-list --- doubly-linked-list | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doubly-linked-list b/doubly-linked-list index c056c0c1..74158ac3 100644 --- a/doubly-linked-list +++ b/doubly-linked-list @@ -125,7 +125,7 @@ void insertion_specified() { temp = head; printf("Enter the location"); scanf("%d", &loc); - for (i = 0; i < loc; i++) { + for (i = 1; i < loc-1; i++) { temp = temp->next; if (temp == NULL) { printf("\n There are less than %d elements", loc); @@ -170,7 +170,7 @@ void deletion_last() { printf("\nnode deleted\n"); } else { ptr = head; - if (ptr->next != NULL) { + while (ptr->next != NULL) { ptr = ptr->next; } ptr->prev->next = NULL;