Update doubly-linked-list

This commit is contained in:
Mohammed Saqib B 2023-10-01 20:11:19 +05:30 committed by GitHub
parent 3c2538880d
commit 16aa68d328
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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;