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

Limiting reactants Aqueous sulfuric acid (H,SO) will react with solid sodium hydroxide (NaOH) to produce aqueous sodium sulfate (Na₂SO) and liquid water (H₂O).
Write the formula for the ionic compound that forms between Ca and Cl2
who hates this year of brainly i know i do i trying log in in i have no problme when doing my homework in when i'm stuck i go here for help but this year i went
Widespread use of this process became practical after finding a replacement for the Klenow fragment. Fluorescent dyes allow the quantitative form of this proces
PLEASE HELPPPPP WILL GIVE BRAINLIEST!!
Please help this is for math
ue el escuela (minutos) 20 201 201 202 21 21호 21호 21호 22 B. Lewis dijo que la diferencia entre la vez que llegó más rápido y la vez que más tardó fue 2 minutos.
martin luther kings strugles
Exposure is the number of units remaining to lease expressed as a percentage. What is the exposure on a property with 892 units if: 106 are vacant, 19 leased an
Factor the expression completely: 40-5x