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

Talk to a 55-year-old (or older) business professional nearing retirement. This person can be a family member, friend, or mentor. List and describe the savings,
The Gulf Stream travels across the AtlanticOcean at theA. Paris MeridianC. EquatorB International DanteleA Prime Meridien​
Show that one zero of 8x230x27 is the square of the other.
what is the most largest flower​
The average of three numbers is 25. two of the numbers are 45 and 16. What is third one.
If x-2y=10 and y is three times the value of x, What is the value of x-y? a) -8 b) -4 c) 0 d) 2 e)4
Which is a justification given for the use of the atomic bomb? A. Japan was ready to surrender soon anyway B. It was the only way American would be able to win
Which is the heaviest of these weight : 1/2 kg , 0.6kg, 125g, 475g
Given: ∠N ≅ ∠S, line ℓ bisects at Q. Prove: ∆NQT ≅ ∆SQR Which reason justifies Step 2 in the proof? If two lines are parallel, then the corresponding angles for
If a balloon takes up 625L at 273K, what will the new volume be when the balloon is heated to 353K.