Question: DO IN C ONLY PLEASE (for all 3 parts please) 1) Write a function named avgArray that takes four arguments: An input array of doubles.
DO IN C ONLY PLEASE (for all 3 parts please)
1) Write a function named avgArray that takes four arguments:
An input array of doubles.
A second input array of doubles.
A third array of doubles, which will hold the output.
An integer that represents the size (no. of elements) of all three arrays.
The function computes the average of the corresponding values in each input array, and stores the result in the third array. In other words, element X of the third array will contain the average of element X of the first array and element X of the second array. The function does not return a value.
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2) Write a function called nth that finds the n-th occurrence of a particular value in an array of integers.
The first argument is an integer array.
The second argument is the length (size) of the array (i.e., the number of integers).
The third argument is the value you want to match (an integer).
The fourth argument is n, the particular match you want to find. In other words, n=1 means the first occurrence in the array, n=3 means the third occurrence, etc. You may assume that n is greater than or equal to one.
The return value is the index of the n-th match in the array, or -1 if there is no such match.
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3) Write function named negateOdd that takes two arguments. The first is an array of integers. The second is the number of integers in the array. The function negates (changes the sign of) every odd integer in the array. It returns the number of odd integers. Warning: Using the modulo (%) operator with a negative operand may result in a negative result.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
