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 local marketing company did a survey of 30 households to determine how many devices the household contained that family members watched video on (i.e. TV’s, t
− 16 = please helllpppp
if I want to become a doctor which program for high school is best, Advanced placement (ap) or International Baccalaureate (ib)? and what's the difference betwe
which was the first hydropower situation of Nepal?​
Try it! >:) How does the reflection of a square over the x-axis affect the interior angles of the square?
What does Jekyll say about his house and Mr. Hyde?
A students has a sample of rock that has a mass of 25 grams and when placed in water has displaced the water about 10 ml. What is the density of the rock? ​
state the law of demand​
1. Explain the term rural-urban drift.2. State four causes of rural-urban drift.3. Explain four effects of rural-urban drift in urban areas.​
Next 1.1 Quiz 9 Select the correct answer. The World Health Organization defines health as a balance of physical , mental, and O A. Social B. Consumer Oc. Finan