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

F is inversely proportional to d^2. When F = 15, d = 4 Work out d (positive value rounded to 2 DP) when F = 6
the Marked price of an article is 25% above its cost price when it is sold at a discount of 15% there is a gain of rupees 200 find the cost price of the article
what is frankfurt government or whatever?pls explain...​
2 3 TIME REMAINING 54:48 In a life-cycle assessment, the impact of demolition is determined once the building has been scheduled to be torn down. True False Mar
How many valence electrons does carbon have and why is it important?
help me again please?​
Change the following percentage to fraction[tex]116 \ \frac{2}{3} \%[/tex]​
4(x−2+y)=4, left parenthesis, x, minus, 2, plus, y, right parenthesis, equals
Help please, easy question. (30 points) *VIEW PICTURE DOWN BELOW* What’s the temperature after 8 minutes? And what’s the temperature after t minutes?
oh ayan libreng puntos mga pitang ina nyo sabihin nyo lng salamat master wally bayola #boldniwallybitin​