Question: Write C program named bigint_dllist.h and bigint_dllist.c containing following structure and operation functions. Define a doubly linked list node structure NODE to hold a character

Write C program named bigint_dllist.h and bigint_dllist.c containing following structure and operation functions.

  1. Define a doubly linked list node structure NODE to hold a character data.
  2. NODE *new_node(char data); this creates a new node using malloc().
  3. void display_forward(NODE *start); this displays char data from start to end.
  4. void display_backward(NODE *end); this displays char data from end to start.
  5. void insert_start(NODE **startp, node **endp, node *new_np); this inserts a new node at the start the of doubly linked list.
  6. void insert_end(NODE **startp, node **endp, node *new_np); this inserts a new node at the end of the doubly linked list.
  7. void delete_start(NODE **startp, node **endp); this deletes the first node of the doubly linked list.
  8. void delete_end(NODE **startp, node **endp); this deletes the last node of the doubly linked list.
  9. void clean(NODE **startp, NODE **endp); this cleans the doubly linked list.

Use the main.c to test the above doubly linked list and operation functions.

main.c

#include "bigint_dllist.h" int main(int argc, char* args[]) { NODE *start = NULL, *end = NULL; int i=0; for (i = 0; i<10; i++) { insert_start(&start, &end, new_node('0'+i)); } display_forward(start); printf(" "); display_backward(end); delete_start(&start, &end); delete_end(&start, &end); printf(" "); display_forward(start); clean(&start, &end); for (i = 0; i<10; i++) { insert_end(&start, &end, new_node('a'+i)); } printf(" "); display_forward(start); clean(&start, &end); return 0; }

public test

 9 8 7 6 5 4 3 2 1 0 0 1 2 3 4 5 6 7 8 9 8 7 6 5 4 3 2 1 a b c d e f g h i j

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!