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

A projectile is fired at an angle such that the vertical component of its velocity and the horizontal component of its velocity are BOTH equal to 30 m/s. a. Usi
A spa has placed a magazine advertisement in a local women’s magazine. What technological feature have the owners incorporated in this advertisement? A. A QR co
Special effects in movies from 1960 and 1970s are not as good as those movies made today becauseMovie audiences were not interested in special effectsDigital ar
Javed downloaded from the Internet two files that had a combined size of 696 megabytes. The size of the first file was 290 megabytes, and it took 5 minutes to d
Who do injured people visit to learn more about stretching exercises and to receive treatment for their recovery? A. personal trainer B. physical therapist C. n
please help me with this!
Which word is the most different from the others? a. complete b. pure c. limited d. absolute
slope graph for m=-1/5
please help, i'll give brainilest Use an eating or drinking verb in a sentence which expresses anger about a situation that might occur in your daily life. Do n
Uhh help With science work Plessssss