Question: Using C program, Objective: In this lab you will implement three functions and a main program. Functions: 1) int countOccurrences(List uList, float item); //This function

Using C program,

Objective: In this lab you will implement three functions and a main program. Functions: 1) int countOccurrences(List uList, float item); //This function returns the number of times item appears in uList. 2) int replaceItem(float newItem, float oldItem, List uList); //This function replaces all occurrences of oldItem in uList with newItem and returns the number of occurrences that were repalced. 3) void printList(List uList); //This function prints out the size of the list and then prints each item on the list one by one. 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), etc. Implementing details: 1. In your main program, initialize a list and set the array to [1.11, 2.22, 1.11, 1.11, 3.33, 2.22, 1.11, 3.33]. 2. Print out the occurrences of item "1.11". 3. Print out the occurrences of item "2.22". 4. Replace all "1.11" with "4.44", and print out the list using "printList". 5. Then after step 5, replace all "4.44" with "5.55", and print out the list using "printList".

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!