mirror of
https://github.moeyy.xyz/https://github.com/TheAlgorithms/C.git
synced 2023-10-11 15:56:24 +08:00
Update doubly-linked-list
This commit is contained in:
parent
3c2538880d
commit
16aa68d328
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user