Question
in C 1. Ask the user to enter in the number of nodes for the linked list 2. Generate a list with the # of
in C
1. Ask the user to enter in the number of nodes for the linked list 2. Generate a list with the # of nodes specified by the user Each node will contain a random number with the range 0-9999 3. Print out the generated list (10 per line)
Required Functions:
node *makeNode(int val); - create a node for your list, should return a pointer to that node (struct node *) node *insertFront(node *head, node *new); - add a node to the front of the list, return new front of list void printList(node *head); - print out the linked list (10 per line)
Example: ---------------------------------------------------------------------- $ ./a.out How many nodes? 20 8430 2799 4782 9705 7778 7618 473 878 8270 7042 4739 8414 188 1474 7954 7162 9796 3059 5374 212
$ ./a.out How many nodes? 15 9564 6561 7377 2904 4080 255 5940 4604 6782 4102 29 1955 5023 5536 8641
$ ./a.out How many nodes? 10 8163 285 4482 4425 5799 6812 7003 5507 1190 6958
$ ./a.out How many nodes? 5 8667 5337 2002 2216 4007
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