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

The road not taken 3. What do lines 16-20 reveal about the narrator? How do you know?
a. The temperature of a system is measured to be 75 °F. Express this temperature in °C, K, and R. b. The temperature of a system has the same numerical value w
answer choices: Angle 1 Angle 7 Angle 4 Angle 8
What was the first place the passenger asked about? the supermarket the museum the big building the park
Need these 2 answered. 25 points! Please show work, Thanks! :)
P(Green Pod or Purple Flower) = Please answer please
(-9x^2 - 2x) – (-9x^2 - 3x)
What is the volume of Box? 5.5 cm 16 cm 13 cm
Mass is 10.3g and Volume is 10 ml. What is the density? 2 g/ml 1.03 g/ml O 1.3 g/ml
What kind of a pronoun is "her" in the following sentence? Damian might go to the movies with her. a. subjective b. objective c. possessive