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

{(51+3)-3^2}divided by 9 times 2
During diffusion, when the concentration of molecules on both sides of a membrane is the same, the molecules will (1 point). . a. move across the membrane
In patriarchal institutionalized religions, women have been __________.
As agriculture became entrenched in the South,
gdp most commonly used measurement
Write the balanced chemical equation for the neutralization reaction that occurs when an aqueous solution of hydrobromic acid (HBr) is mixed with an aqueous sol
Turn in a written description of one family member and one friend. Include the following information: •The name of the person you are describing. •Two adjective
1. Spending requests for the general welfare of the United States generally comes from the A.people. B.executive branch. C.House of Representatives. D.Senate.
Find the square of (4x – 6y3)2
9. What is .333 written in its simplest fraction form? A. 1,000/333 B. 1 /3 C. 333/1,000 D. 3 /33 3/33