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

If you know an object ditance from the un in kilometer how can you find it ditance
Solve for b in A = a + b ——- 3 Help ASAP!!
Any/one want to be friends? Yes? No? Maybe? :P
Please I need help on this I don’t get how to do it, show your explanation please and thank you!
I the convere of the following conditional True or Fale? "If a polygon i a triangle, then it ha exactly three ide. "
El conocimiento vulgar, es el que todo el mundo posee, por el hecho de haber nacido en una cultura. Seleccione una: O Verdadero O Falso
Record two details from placard _____that show how it relates to this category
A beaker contains a 25 ml solution of an unknown monoprotic acid that reacts in a 1:1 stochiometric ratio with naoh. Titrate the solution with naoh to determine
i need assistance with this
Which negative characteristic of an assertive person can cause them to assume that everything will be positive and work out, which can create issues when trying