Assume that a circular doubly linked list has been created a
Assume that a circular doubly linked list has been created, as in Figure E3.1. After each of the following assignments, indicate changes made in the list by showing which links have been modified. Process these assignments in sequence; that is, the second assignment should make changes in the list modified by the first assignment, and so on. list.next.next.next = list.prev; list.prev.prev.prev = list.next.next.next.prev; list.next.next.next.prev = list.prev.prev.prev; list.next = list.next.next; list.next.prev.next = list.next.next.next;
Solution
The following program would help the user execute this program.
void addXtoList(struct node *node, int x)
{
while(node != NULL)
{
node->data = node->data + x;
node = node->next;
}
}
struct node *head = NULL; // declaring as a global head pointer
void deleteFirst()
{
if(head != NULL)
{
struct node *temp = head;
head = head->next;
free(temp);
}
}
This code can help the user to insert the node and get the program getting executed.
