Question: In C Programming: In this lab you will implement two functions using header files and a main program. Functions: 1) float swapAtIndex(int index, List uList);

In C Programming:

In this lab you will implement two functions using header files and a main program. Functions: 1) float swapAtIndex(int index, List uList); //This function swaps the item at location index with the item at the beginning of the list. The original item at index is returned. 2) float copyMax(List oriList, List *newList); // This function searches for the maximum value in oriList array and copies the value into newList array. The maximum value is returned You should use the same typedef struct from last lab, which is: typedef struct listnode{ int maxSizeOfList, tail; float *array; }List And you can continue to use functions implemented from last lab, such as createList(int size, List* ulist), deleteItem(int index, List* ulist), printList etc. Implementing details: 1. Create two header files (Lab4.h and Lab4.c) and a main program, declare your prototypes in Lab4.h file and implement the functions in Lab4.c file. 2. In your main program, initialize a list and set the array in list to [1.11, 2.22, 3.33, 2.22, 1.11]. 3. Swap item at index 3 with the first item. Now your array in list should look like this: [2.22, 2.22, 3.33, 1.11, 1.11]. 4. Swap item at index 10. Watch out for the array boundary. 5. Then after step 4, create a new List, search for the maximum value in original list, and copy it to this new list. Your new list array should look like this [3.33].

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!