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

Find the inequality represented by the graph.
How to simplify 4x^5•3x
What is the fbla magazine called that is published for middle and high school members
Brianna received a $398 paycheck last week and then spent $49 of her earnings on a gift. How much of her earnings remained after she bought the gift?
How many Children attended the classroom if there were 11 girls who made up 44% of the children?
starch molecules are actually long chains of glucose molecules. When you eat food containing starches, such as potatoes, your body breaks down the starch into t
Write the standard form of the equation of the line passing through the point (1,2) and perpendicular to the line x-5y=10
Samantha experienced a traumatic brain injury and afterward began to exhibit bizarre symptoms that no one had ever documented before. The best research method t
Is it more costly to Andrew to go to graduate business school full time or part time if the tuition is the same for each? A. Part time B. It costs the same whe
Reflect D(3,3) E(0,5) and F(-2,2) on the x axis and then lable them D' E' and F'​