179k views
5 votes
Write the definition of a function named max that receives an int parameter and returns the largest value that it has been called with so far. So, if you make these calls to max, max(5), max(3), max(12), max(4), the values returned will be (respectively): 5, 5, 12, and 12.

2 Answers

2 votes

Answer:needed points

Explanation:sorry

User Arthur Reutenauer
by
5.9k points
4 votes

Answer:

Following are the code in the C language .

int max(int x) // function definition

{

static int largest=0; // variable declaration

if (x>largest) // checking the condition

largest=x; // assign the value of input in the largest variable

return largest; // return the largest number

}

Step-by-step explanation:

Following are the description of code .

  • Decalred a function max of int type which hold a parameter x of int datatype.
  • In this function compared the number x with the largest .If this condition is true then largest number hold the value of x variable
  • Finally return the largest number .
User Muricula
by
6.2k points