Answer:
double * maximum( double arr[], int size){
int max = 0;
if ( size == 0){
return 0;
} else {
for (int i = 1; i < size; i++){
if (arr[i] > arr[0]){
max = arr[i];
} else {
max = arr[0];
}
}
return max;
}
}
Step-by-step explanation:
The C++ source code above returns the maximum value of an array as a pointer. The function accepts two parameters, the array in question and the size of the array. The for loop iterates over the items in the array and checks for the largest, which is returned as a pointer since the function "maximum" is defined as a pointer to the floating-point number memory location.