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

is drinking a large amount of alcohol very quickly for the sole purpose of getting impaired.beer bong
In 30 seconds and with a force of 750 N, a body builder lifts some heavy weights above the ground by 2 meters. How much power does the body builder have?
simplify 64 2/3 ÷8 2/3
Find the pair of words that has the same kind of relationship as the numbered pair. spectrum : range :: A. repartee : departure B. repertoire : music
an suv is traveling at a speed of 18 m/s. If the suv has a mass of 1,550 kg, what force must be applied to stop it in 8 seconds?
Solve for x 5 – 57− 2 = 63 please help
the legend of Romulus and remus
Using these images as inspiration, write a claim, one or two sentences in length, in support of the soda ban.
the armenian massacre the holocaust and the rape of nanking are examples of?
which part of the cell membrane is polar and allows the cell to exist in water