Doubly Linked List deletion
delete node from beginning of a doubly linked list

use code from the create and display nodes and getnode function to assign data click here
- create a function deletebeg( )
- create a *temp pointer
- initialize head to the temp pointer (temp=head)

4.move head pointer to the next node (head=head->next)

5.change previous address field of head node to NULL (head ->prev = NULL)

6.delete temp node using free keyword in c

7.first node will be deleted

code to delete node from beginning of a doubly linked list
void deletebeg()
{
node *temp;
if(head == NULL)
{
printf("\n Empty list");
getch();
return ;
}
else
{
temp = head;
head = head -> next;
head -> prev = NULL;
free(temp);
}
}
delete node from ending of a doubly linked list
use code from the create and display nodes and getnode function to assign data click here
- create a function deleteend( )
- create a *temp pointer
- initialize head to the temp pointer (temp=head)

4.move temp pointer to the last node by changing the address in the temp pointer (temp=temp->next)until the condition (temp -> next != NULL)

5.change last-second node next value to NULL, by the below code
temp -> prev -> next = NULL

6.delete temp node using free keyword in c

7.last node will be deleted

code to delete node from ending of a doubly linked list
void deleteend()
{
node *temp;
if(head == NULL)
{
printf("\n Empty list");
getch();
return ;
}
else
{
temp = head;
while(temp -> next != NULL)
temp = temp -> next;
temp -> prev -> next = NULL;
free(temp);
temp = NULL;
}
}