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
How to make the heart symbol in photoshop
sveta [45]
Click the font drop-down box in the tool settings bar. Select "Arial." 6. Press "Alt-3" using your keyboard number pad's "3" key to insert the heart symbol<span>.</span>
3 0
3 years ago
Read 2 more answers
study the picture of the simulation and the graph above. based on the information obtained from your study of the simulation and
andreyandreev [35.5K]
This is how you know i’m def gonna fail my university class this year :/
6 0
2 years ago
PLEASE HELP!!! WILLGIVE BRAINLIEST!!!
morpeh [17]
Black absorbs all visible parts of the spectrum turning that light energy into heat. The more it absorbs the more heat it emits.
4 0
3 years ago
Read 2 more answers
The ____ command can be used to view the contents of a record when it is anticipated that the record will need to be modified. I
GREYUIT [131]

Answer:

The correct answer is B)

Explanation:

The commit command allows us to:

• Consolidate, confirm

• committing refers to the idea of confirming a set of provisional changes permanently.

• A popular use is at the end of a database transaction.

•

The LOCK TABLE command should be used:

• when a lock of the mode specified in the table can be acquired.

• The command will wait for everything you need to get the lock,

• In case you cannot acquire the lock immediately, the NOWAIT option is specified so that the command cancels the transaction.

6 0
2 years ago
List seven basic internet components found in a computer tower
Alexxandr [17]
A Mouse and a Keyboard are examples of eternal input devices. The monitor, printer, speaker and Fash drive are all external output devices. Seven basic internal components in a computer tower are the power supply unit, central processing unit, hard disk drive, RAM modules, motherboard, video card and a sound card.
8 0
2 years ago
Read 2 more answers
Other questions:
  • An automobile battery, when connected to a car radio, provides 12.5 V to the radio. When connected to a set of headlights, it pr
    11·1 answer
  • If you are trying move a hard drive from a non-working computer to a working computer for the purposes of accessing the data on
    5·1 answer
  • To paste text with the same formatting as the document in which it is entered, select _____ from the Paste menu. Keep Source For
    12·2 answers
  • Create an application named Percentages whose main() method holds two double variables. Assign values to the variables. Pass bot
    14·1 answer
  • Given an initialized String variable outfile, write a statement that declares a PrintWriter reference variable named output and
    12·1 answer
  • Identify a characteristic of electronic meeting systems.
    10·1 answer
  • How to convert a .enw file into a .pdf without downloading any applications? (If I have to, then I will. Just please tell me.)
    14·2 answers
  • What are other ways you could use the shake or compass code blocks in physical computing projects?
    14·1 answer
  • Which of the following is a characteristic of a college savings plan
    6·2 answers
  • What is white light?
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!