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 of these is an example of how the media can perpetuate common sexual stereotypes?
A Body is said to be in equilibrium when its:- a) Acceleration is uniform b) Speed is uniform c) Speed and acceleration are uniform d) Speed is uniform I need
find the equation of the line shown
is variation always caused by the surroundings?
7). Express 98 in base 2​
If the angles (4x + 4)° and (6x – 4)° are the supplementary angles, find the value of x.
They went with an employee from this agency. (ask about the object: use whom) help please ​
Why is international trade important for most countries? A. It makes countries more independent and less reliant on foreign countries. B. It prevents countries
what event led to the declaration of martial law during the time of former president ferdinand ?? (about the old president on Philippines)
true or false,the diagonal of a rectangle is longer than any of its sides. I want the answer with explanation If u don't I will report​