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

Light boxes and tents are typically used for fine art photography. True or False
what cause a person with PTSD to kill someone
50 POINTS!!! What are phylums??? i have to categorize my house items into different phylums and i have no idea. plzzz help
how to solve dividing radicals
Kiya used wire fencing to form a border around a circular region in his back yard. If the radius of the circular region was 5 yards , what was the total length
Hey,can you find an area of a trapezoid that has 0.2 for base 1 and 0.6 for base 2 and also 0.2 for its height
그러나 그는 이어 아직 수상 소감 같은 것도 준비 안했다 있는 것 같습니다 달리 산적과 아낙네 있는 것 같습니다
PLEASE HELP ASAP !! - The electric company needs the estimated height of a tree. The shadow the tree makes with the ground is 25 feet and the angle of elevation
which of the following forms at mid-ocean ridges​
Find a a. 4 b. 6 c. 9