Question: IN C PROGRAMING // This function creates an empty list pointer and returns it. List* createList ( ); //This function adds an integer item to
IN C PROGRAMING
// This function creates an empty list pointer and returns it. List* createList ( ); //This function adds an integer item to the end of the list by taking a list pointer and an integer item to be added and returns the updated list pointer. List* addItemAtEnd (List*, int); //This function adds an integer item to the beginning of the list by taking a list pointer and an integer item to be added and returns the updated list pointer. List* addItemInBeginning (List*, int); //This function prints out the items in the list passed through the parameter. void printList (List); main description: 1. Create a linked list ADT based on the given structures in the header file. 2. Generate 13 random integer numbers in a range between 1 and 13. Print out the 'generated' numbers on the console separated by space. 3. Add first 6 of the 13 numbers one by one to the beginning of the list and the remaining 7 numbers one by one to the end of the list. 4. Print out the list on the console. Example output: mwc-070138:~ $ gcc main.c lab5.c -Wall -Werror mwc-070138:~ $ ./a.out Randomly 'generated' numbers: 1 1 2 4 3 5 13 10 3 11 2 6 5 Items on the linked list: 5 3 4 2 1 1 13 10 3 11 2 6 5 Hint: A function to generate random number in range(min,max): int random_int(int min, int max) { return (min + rand() % (max+1 - min)); }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
