Question: Write a function replaceNums that replaces each element except the first and last by the larger of its two neighbors. Your function should take two

Write a function replaceNums that replaces each element except the first and last by the larger of its two neighbors. Your function should take two parameters, an integer array and the array length (in this order).Your function should not return or print anything. Examples int myArray[2] = {1, 5); {1,5} int myArray[1] = {1}; {1} int myArray[3] = {1, 3, 5); {1, 5, 5} int myArray[3] = {5, 3, 1); {5, 5, 1} int myArray[5] = {1, 2, 3, 4, 5); {1, 3, 4, 5, 5} int myArray[5] = {5, 4, 3, 2, 1); {5, 5, 4, 3, 1} Note: as you attempt to replace elements of the array, keep in mind that once an element's value is overwritten, you won't be able to have access to the old value. Think of a way to "remember" the original values in the array. Good luck
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
