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

Find the slope of the line that passes through the points. (1,9) and (4,5)
A naval submarine was operating 310 feet below the surface of the ocean. To pass above an underwater mountain or seamount, it rose 165 feet. What is the positio
What lesson did the time traveler learn in the novel “the time Machine” if the theme is persevering through obstacles.
-5j + 3 = -4j - 2 please someone help me solve for j
the name of the ugliest and prettiest colors in the world
What is the best and easiest way for a guy to loose weight.
Let{sn} be a geometric sequence that starts with an initial index of 0. The initial term is 16 and the common ratio is1/2. What is s3
fact family for 6,7,and42
If FGH = IJK,which congruent to GH
Find the value of the variable in the polygon.