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
You are the administrator for a network with a single Active Directory domain called westsim. All computer accounts reside in or
N76 [4]
Link a GPO to the Marketing OU. In the GPO, edit the Enable client-side targeting policy and specify the Marketing Computers group.

In the WSUS console, edit the options for Computers and specify Use Group Policy or registry settings on computers.

In the WSUS console, create a Marketing Computers group.
3 0
3 years ago
To change the backround color of a page, which tab would you use?
ivann1987 [24]
I have concluded the answer is a
4 0
3 years ago
Read 2 more answers
The language a person speaks is one example of ________________.
adoni [48]

Answer: b. Códigos de comunicación/ comunication codes

Explanation:

5 0
3 years ago
Read 2 more answers
Which of the following are good backup methods you can use to protect important files and folders from loss in the case of a har
grigory [225]

Answer:A,B, and D

Explanation:

6 0
3 years ago
Read 2 more answers
Pls help asap<br> 40 pts<br><br> How to determine the audience for a storyboard for a movie review?
Alecsey [184]
Look at the subject of the movie, think about the type of people that would watch that, gore/blood- boy teens sad/depressing- girl teens
8 0
3 years ago
Other questions:
  • Design a module named getNumber, which uses a reference parameter variable to accept an Integer argument. The module should prom
    6·1 answer
  • List and briefly defined categories of security services.
    8·1 answer
  • Which actions should be taken so that transitions proceed automatically? Check all that apply.
    12·2 answers
  • Which of the following are examples of the concept of layered access in physical security? Select one: a. Firewall, IDS, CCTV b.
    11·2 answers
  • Word processing programs have different view options that you can use depending on the tasks your performing
    5·1 answer
  • What is the device that uses sprockets along a film's perforated edges to run 50 feet of film in thirty seconds? A. cinematograp
    10·1 answer
  • Most operating systems today primarily use a ____.
    12·1 answer
  • Write the contrapositive of each of the following statements. Healthy plant growth follows from sufficient water. Increased avai
    7·1 answer
  • I'd: 9872093250, password: qqqqq, join the meeting​
    11·1 answer
  • Is ryan patrick cullen gay
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!