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

Write 0.0003532 in scientific notation. a. 3.532 × 105 b. 3.532 × 10 4 c. 3.532 × 104 d. 3.532 × 10 5
Parasitic infections generally infect the __________. a. skin and lungs b. intestines and skin c. lungs and intestines d. blood and intestines
Let x represent any number in the set if even integers greater than 1
Which of the following recursive formulas represents the same geometric sequence as the formula an=2x3n-1
Why did president Harry s Truman ask congress for funds for Greece and turkey
Where is Taraba state?
What can be multiplied to get 5 and added to get 4
explain why some african amerian were loyalists while others were patriots during the american revolution
Which of these is always part of using the scientific method
As the costs for the war in Iraq increased,