Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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.
- Define a doubly linked list node structure NODE to hold a character data.
- NODE *new_node(char data); this creates a new node using malloc().
- void display_forward(NODE *start); this displays char data from start to end.
- void display_backward(NODE *end); this displays char data from end to start.
- void insert_start(NODE **startp, node **endp, node *new_np); this inserts a new node at the start the of doubly linked list.
- void insert_end(NODE **startp, node **endp, node *new_np); this inserts a new node at the end of the doubly linked list.
- void delete_start(NODE **startp, node **endp); this deletes the first node of the doubly linked list.
- void delete_end(NODE **startp, node **endp); this deletes the last node of the doubly linked list.
- 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started