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

Read the passage. (1) William Shakespeare was born in 1564 in Stratford-upon-Avon. (2) It is a town in England. (3) He is believed to have attended the King’s N
As a result of the French Revolution, the Catholic Church in France _________________________. Question options: a) was strengthened b) was permanently driven
Solve the system of linear equations using the Gauss-Jordan elimination method. 2x + 10y = 21 −6x + 8y = 32
What is a-85=14 in math
4. Today we know the true shape of the path of the earth about the sun. What is it?
Which process is responsible for continually wearing away the Earth's surface? deposition folding erosion faulting
4. A hydraulic conductivity of 7.6 ft/day converts to __________ m/day. Answer to 1 decimal place.
Why was the invasion of the Byzantine empire by the Seljuk Turks significant?
Find QS if QR=7, RS=31+2x, and QS=x+26
Which situation would most likely result from citizens engaging in civic participation? O A. Citizens have more say in political changes. O B. Citizens run for