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. Hydrogen B. Sodium C. Neon D. Magnesium
What is maas? How it measured? class 8​
51 neutrons 38 protons 36 electrons
Is program a collective noun?
What is someone please help me subject:algebra 1 5/2x-x=3+3/2x
Please help and answer the question​
Type the integer that makes the following subtraction sentence true for Brainliest!!!!!!!!!!
What fraction is equal to 75% of 1/2
Read the question carefully and select the best answer. Which of these inferences about Marlow is best supported by the excerpt? O A. He seeks out adventure in
Cos ( 3x-7 ) = Sin (2x+5 )