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

by considering action-reacton forces,identify why water rises up a thin capillary tube
with the use of relevant illustrations, discuss the view that expenditure approach= output approach= income approach ​
what care should be taken before using emergency contraception​
The graphs below have the same shapes. What is the equation for the red graph?
How many liters of a 0.80 M solution can be made with 2.0 mol KNO3? {?} L
How many people world-wide generally die during the flu season? 10 Million 20 Million 30 Million 40 Million
In experiments intended to measure conformity it was found that
please help me! I really need this answer ​
simplify 1 1 3 - 4 1 3 =
A rental car agency charges $230 per week plus $0.25 per mile to rent a car. How many miles can you travel in one week for $415? The number of miles you can tra