Question: FILE Linkedlist.c (below) #include #include #include struct NODE { struct NODE *link; int value; }; typedef struct NODE Node; Node *insertFirst( Node **ptrToHeadPtr, int val

FILE Linkedlist.c (below)
#include
struct NODE { struct NODE *link; int value; };
typedef struct NODE Node;
Node *insertFirst( Node **ptrToHeadPtr, int val ) { Node *node = (Node *)malloc( sizeof( Node ) ); node->value = val; node->link = *ptrToHeadPtr; *ptrToHeadPtr = node; return node; }
void traverse( Node *p ) { while ( p != NULL ) { printf("%d ", p->value ); p = p->link; } }
void freeList( Node *p ) { Node *temp; while ( p != NULL ) { temp = p; p = p->link; free( temp ); } }
int main() { Node *HeadPtr = NULL;
int j; for ( j=0; j
traverse( HeadPtr ); freeList( HeadPtr ); getchar(); return 1; }
PROGRAM IN LANGUAGE C Additional Linked List Functions Start with the file linkedList.c in the notes for chapter 12. Use the same style of linked list as discussed there. Add the following three functions. A nice way to do this is to put your functions in a separate file, perhaps called myLLfunctions.c and then use the preprocessor to include that file into linkedList.c struct NODE struct NODE link; int value; typedef struct NODE Node; #include "myLL functions . c" 3. Write the function int deleteFirst (Node *ptrToHeadPtr) that deletes the first node of a singly linked list. The return value is 1 if the operation succeeded, or 0 if not. The operation fails if free ) fails. If the list is already empty, change nothing and return a 0. Note that the head pointer variable to the linked list in main) may be altered, so the parameter is a pointer to the head pointer variable. You will need to write a main that tests your functions The functions themselves should not write out anything. Your functions should not use any global variables since the grading program will not have those global variables
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
