1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
ANEK [815]
3 years ago
8

Write a function that determines the maximum and minimum values from a one-dimensional array. Assume that the corresponding func

tion prototype statement is void ranges(int x[], int npts, int *max_ptr, int *min_ptr) where npts contain the number of values in array x, and max_ptr and min_ptr are pointers to the variables in which to store the maximum and minimum values in the array.
Computers and Technology
1 answer:
erica [24]3 years ago
8 0

Answer:

void ranges(int x[], int npts, int *max_ptr, int *min_ptr)

{

   *max_ptr=*min_ptr=x[0];

   for(int i=1;i<npts;i++)

   {

       if(x[i]>*max_ptr)        //this will put max value in  max_ptr

           *max_ptr=x[i];

       if(x[i]<*min_ptr)  //this will  put min value in min_ptr

           *min_ptr=x[i];

   }

}

Explanation:

The above function can be called like :

                                    ranges(x,n,&max,&min);  

where x is array and n is number of elements and max and min are address of variables where maximum and minimum values to be stored respectively.

You might be interested in
What does a companys code of ehtics cover
Stolb23 [73]
A code of ethics and professional conduct outlines the ethical principles that govern decisions and behavior at a company or organization. They give general outlines of how employees should behave, as well as specific guidance for handling issues like harassment, safety, and conflicts of interest.
4 0
1 year ago
Read 2 more answers
what will be the Trade discount and Invoice Amount if the List Price is $400.00 and the Trade Discount Rate is 85%
V125BC [204]

Answer:

$340

Explanation:

you have to multiply $400 bu 85% to get $340

4 0
2 years ago
Consider the cement used for the foundation; the bricks and timber used for the walls; and the shingles used for the roof. All o
gavmur [86]
<span>Consider the cement used for the foundation; the bricks and timber used for the walls; and the shingles used for the roof. All of these are __________ in making the house.

A. Elements</span>
6 0
3 years ago
What does this mean, i am so confused- Explain the importance of identifying the purpose/use for pre-production documents
irina1246 [14]

Answer: These are mostly used in interior design, fashion design, and advertising. they are often used to generate ideas for a client to meet their approval before making the final product. It can help in terms of planning because it could be used to create a design or a theme.

Explanation: yw

4 0
3 years ago
What is the abuse of electronic messaging systems to indiscriminately send unsolicited bulk messages, many of which contain hoax
Ilya [14]

I think the answer is spam
5 0
2 years ago
Other questions:
  • How is a network printer identified on the network?
    8·1 answer
  • WHICH OF THE FOLLOWING LOOKS JUST LIKE A CD ROM BUT CAN STORE MUCH MORE INFORMATION
    8·2 answers
  • Declare an array named tax rates of five elements of type double and initialize the elements (starting with the first) to the va
    12·1 answer
  • A process that rearranges the data and objects in a database to decrease its file size, thereby making more space available on y
    11·1 answer
  • Which of the following types of computers is typically used by governments and hospitals and can support hundreds of users?
    6·2 answers
  • In our discussion of Computer Hardware, we talked about three essential hardware components that are there inside every computer
    14·1 answer
  • How do you change the order of the slides in your presentation in the slide pane 
    15·2 answers
  • You manage a network that uses switches. In the lobby of your building, there are three RJ45 ports connected to a switch. You wa
    5·1 answer
  • Fill in the word to complete the sentence.
    10·1 answer
  • Which of the following digital communicatio media does not require a connection to the internet
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!