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

Identify the transport mechanism: a passive process that uses a pressure difference as its driving force: a. ATP-driven pumps b. diffusion c. filtration d. faci
Which describes a pattern without explanation? theory observation law inference
Probability of the card not being an Ace. ​
A microspore develops into a(n) A. seed B. sporophyte C. male gametophyte D. female gametophyte. E. ovule.
Which ordered triple is plotted?
What are the two main functions of keeping the stomach highly acidic? a. Increasing the absorption of carbohydrates b. Help breakdown complex lipids molecules
The lengths of human pregnancies are normally distributed with a mean of 268 days and a standard deviation of 15 days. What is the probability that a pregnancy
BEFORE ANYONE ANSWERS THE ANSWER THE ANSWER IS NOT 10. 3 mi !!! becuz if u look at the sides one has one line the other has two!!! find the value of D!!!
he coordinates of the point that is a reflection of Y(-4, -2) across the x-axis are (, ). The coordinates of the point that is a reflection of Y across the y-ax
Which BMI range is considered ideal?