Question: In this exercise you are to implement a function to remove a given value from an integer array, which may contain duplicates of the value

 In this exercise you are to implement a function to remove

a given value from an integer array, which may contain duplicates of

In this exercise you are to implement a function to remove a given value from an integer array, which may contain duplicates of the value to be removed. Requirements Write a single function called remove that returns an integer and has three parameters - an integer array, an integer reference parameter and an integer (in that order). Parameters 1. The array parameter represents the array from which values are to be removed. 2. The integer reference parameter represents the number of values stored in the array, the remove function should set this parameter to the number of values stored in the array after removal - which is why it is a reference parameter. 3. The integer parameter represents the value to be removed from the array. Functionality Any array elements equal to the function's third parameter should be removed from the array. To remove a value, all array elements, if any, with indexes greater than the index of the value to be removed should be moved down one index, the order of the array elements should otherwise remain unchanged. The function should return the number of values that were removed and should set the integer reference parameter to the new number of values in the array. Pre Condition You may assume that: 0

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!