holbrookcole984 holbrookcole984
  • 03-12-2018
  • Computers and Technology
contestada

Given an array arr, of type int, along with two int variables i and j, write some code that swaps the values of arr[i] and arr[j]. declare any additional variables as necessary.

Respuesta :

tonb
tonb tonb
  • 03-12-2018

You'll need a helper variable for this, so depending on your programming language, the solution becomes:

int helper;

helper = arr[i];

arr[i] = arr[j];

arr[j] = helper;

Answer Link

Otras preguntas

The principles of ____ law are demonstrated when pressure remains constant, but temperature and volume rise and fall together.
The measure of an angle is 75°. What is the measure of its supplement?
what do you think Americans thought of FDR?
The nurse is caring for a 12-year-old child with crohn disease. What assessment finding will the nurse report to the health care provider when caring for the ch
Which describes a likely advantage of the roots that gymnosperms have? They are shallow, preventing the plants from growing too tall above ground. They are shal
4) Describe the different types of Semantics, when and how are they applied, what are the advantages or disadvantages to each type.
Why was Monroe doctrine important
A commercial jet has been instructed to climb from its present altitude of 9000 feet to a cruising altitude of 57000 feet. If the plane ascends at a rate of 400
A chemical that affects neuronal function but is not stored in presynaptic vesicles is:.
Which states ratified the constitution with the addition of the bill of rights?.