Question: i need help finishing my C code #include bigint_dllist.h NODE *new_node(char data) { NODE *np = (NODE*) malloc(sizeof(NODE)); if (np == NULL) { printf(malloc fails);
i need help finishing my C code
#include "bigint_dllist.h"
NODE *new_node(char data) {
NODE *np = (NODE*) malloc(sizeof(NODE));
if (np == NULL) {
printf("malloc fails");
return NULL;
}
np->data = data;
np->prev = NULL;
np->next = NULL;
return np;
}
void display_forward(NODE *np) {
if (np == NULL)
return;
NODE *ptr = np;
while (ptr != NULL) {
printf("%d", ptr->data);
ptr = ptr->next;
}
}
void display_backward(NODE *np) {
if (np == NULL)
return 0;
NODE *ptr = np;
while (ptr != NULL) {
printf("%d ", ptr->data);
ptr = ptr->prev;
}
}
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.
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
