Question: (a) (2 pts) Suppose node struct and createNode (data) in our linked list have been defined as following. Write the following functions: I) maino function

(a) (2 pts) Suppose node struct and createNode (data) in our linked list have been defined as following. Write the following functions: I) maino function that generates 10 random numbers in range of 1 to 1000 and insert them intoa linked list by calling insertNode (node *head, int data) function. 2) insertNode (node -head, int data) function that inserts into the end of the linked list and retuns the head of the linked list. Allocate a naw node Initialize its ields Raturn the pointer node createNode (int data) // Ba ic linked list nod struct ; contains 'data' and 'next' pointer typedef struct node if (ptr NULL) data field int data tprintr(stder, "Errorin axit (i) /t the next noda in the 1ist struct node next node: ptr-data-data; return pt: int nain (void) (b) pts) Write a function that reverses the above linked list given the pointer to the head node of the linked list. node * rever (node *head)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
