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

What is 9m + 2 = 3m - 10
How many times does 3/4 go into 4 1/2?
How many valence electrons are available for bonding in bromine (Br)?
How did thomas paine's pamphlet Common Sense change the way many people viewed their king? what other significant effects did it have?
How does silicon shape our technological reality?
What would be your definition of Social Studies?
Can you extend the zero product property to non zero products of numbers? For example, if ab=8, is it always true that a=8 or b=8? Explain
What is 7/8 and 4/9 closer to 0,1,2,or 3
Most autobiographies convey A. a sorrowful tone. B. the significance of fame. C. flashbacks of events. D. a significant message or lesson.
Two different ways to find the difference for 12-3