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

Which page in a web site do viewers usually see first?
During her warm-up, Diane moves her arms side to side for 12 repetitions, using gradual and controlled movements. This type of stretching is called static stret
Which statement explains why Justice Kennedy found the RFRA unconstitutional
PLZZZZZZ NEED HELP!!!!!!!
The first side of a triangle is 2 inches shorter than the second side. The third side is 5 inches longer than the second side. If the perimeter of the triangle
What was the last musical instrument that joined the mariachi?
What single measurement describes both the similarity and difference that exists between a golf ball and a table tennis ball?
Which of the following describes the product rule? The probability of two dihybrid events happening is the product of their probabilities. The probability of t
List three physical properties of a soft drink
What following government officials are in the executive branch