Write a function called find_min_max() that accepts an array of doubles and the
ID: 3532274 • Letter: W
Question
Write a function called find_min_max() that accepts an array of doubles and the number of items in the array as input parameters, and returns the minimum and maximum values in the array through output parameters.
__________________________________________________________________________________
Write a function called reverse_array() that accepts an array of integers and the number of items in the array as parameters, and reverses the items in the array. Hence, the first item in the array should become the last one, and the last one in the array should become the first one, etc. You may NOT create a second array to solve this problem!
Explanation / Answer
1) double find_min_max (double array[100] , int n)
{
double min = 9999999999 ,max = -999999999, result[2];
int i;
for ( i=1;i<=n-1;i++)
{
if ( array[i] < min)
{
min = array[i]
}
if(array[i] > max)
{
max = array[i];
]
}
result[1]=min;
result[2]=max
return result;
}
2) void reverse array(array[100],n)
{
int i;
for ( i=1;i<=n/2, i++)
{
array[i]= array [n-i];
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.