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

Complete the table below to show the relative frequencies of the data in the first column. Enter numbers in the boxes as decimals to the hundredth place.
a bacterium living in an underground septic tank thrives by absorbing organic compounds from decomposing wastes. What is it? A. a chemoheterotroph B. a photohe
What, according to Milton, is the purpose of poetry?
Pedal is to bicycle as paddle is to
At the age of 18, Albert inherits $100,000 from his grandfather. One bank offers to invest this money at 10% for 5 years. A second bank offers a rate of 8% for
Helppp answer?????????
Whats expanded form for 47.487?
you download a digital album for $10. Then you and your friend download the same number of individual songs for $0.99 each. Write a system of linear equations t
In order to increase the amount of water available for human consumption in the Middle East, most governments have been forced to reduce the amount of _________
(Who/Whom) did you ask to help us?