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

I = {1, 2} List all possible subsets of the given set.
name 2 sound devices and what type they are from the song Where Is The Love by the Black Eyed Peas.
factoring 12m^2n^2-8mn+1=
In Romeo and Juliet act 2, which character serves as a messenger
A storage tank shaped Like a rectangular prism is being manufactured to hold 100,000 cubic feet of natural gas. It has a length of 10 feet and a width of 25 fee
In Romeo and Juliet act 2, which character serves as a messenger
In Romeo and Juliet act 2, which character serves as a messenger
Question: 35/8 ( write as mixed number ) Please help me very very quickly!!!!!!!!!!!!!!!!!!!
In Romeo and Juliet act 2, which character serves as a messenger
distribute (x+1)(x-2)