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

An employee old annual salary was $45,650 if his annual salary increased by 25% then find his new salary
Which skill is required in advocacy? communicating analyzing influences setting goals making decisions
Study the image above. Which of the following names should you place on the line labeled “c”
who was the founder of Connecticut? A, roger Williams b. Mary dyer c. Anna Hutchinson d.Thomas hook-er
Which of the following statements best explains why direct democracy worked in ancient anthems? A) the council controlled the work of the assembly B) people w
WIll give brainiest answer if you are correct.
How does religious influence on governments dictate law
which statement accurately describes the relationship between the northwest ordinance and articles of confederation
Aerosol cans contain a written warning not to subject the can to high temperatures or incinerate. Suppose an aerosol can is heated from 22°C to 110°C. What woul
two objects each weighing 2kg are lifted through the same distance in 4s and 1s respectively. which scenario requires more work?