Question: Write a program that uses a function largestValue(int[], int) that takes as an argument an array of integers and the size of the array and
Write a program that uses a function largestValue(int[], int) that takes as an argument an array of integers and the size of the array and returns the largest value in the array. Part of the code is given. Complete the remaining code (function definition) to produce the desired output.
#include
using namespace std;
int largestValue(int [], int);
int main() {
const int arraySize = 10;
int myArray[arraySize] = {3, 4, 6, 21, 8, 13, 25, 1, 7, 11};
cout << "The largest integer is: " << largestValue(myArray, arraySize);
return 0;
} // end main
int largestValue(int a[], int sizeOfArray){
}// end largestValue()
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
