sarahsatan1473 sarahsatan1473
  • 02-04-2021
  • Computers and Technology
contestada

(TCO 4) The following function returns the _____ of the array elements. int mystery(int a[], int n) { int x=a[0]; for (int i=1; i

Respuesta :

Jamesanny20
Jamesanny20 Jamesanny20
  • 03-04-2021

Answer:

Answered below.

Explanation:

The function returns the largest of n number of elements in the array.

It takes an int array parameter int[] a, and an integer parameter n. It then assigns the first element of the array to an integer variable X.

The for loop begins at the second element of the array and loops less than n number of times. In each iteration, it checks if the element is greater than X and swaps it with X.

The function finally returns X.

Answer Link

Otras preguntas

The tag used for starting a new line is ________.​
Which type of narrator would an author use if he or she wanted to focus on the thoughts and feelings of only one character
please help me with number 10
Distance points between G(-5,4) and H(2,6)
Is it true that One of the first colonies set up in what is now the USA was Jamestown.
Classify the number below. Select all that apply. 0.83 Real Rational Irrational Integer Whole Natural (the 3 has a line above it )
show step by step on how to solve 3/4 P=4/5 P + 3/2
List all the steps of the naturalization process
If segment YZ = segment WX and segment WX = segment UV, then A. Segment WX = segment WX B. Segment YZ = segment UV C. Segment YZ = segment WX D. Segment WX = se
Initially, Greg has a total of 60 DVDs and CDs in his collection. He then sold 1/8 of his CDs and 1/2 of his DVDs. If the number of DVDs he sold is twice the nu