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

what is 10 divided by 5/8
To increase an amount by 30% what single multiplier do you use
What people and events shaped the abolition movement the most
Another name for the National Socialist Party was
The answer to 3 problems 1/4 foot= how many inches. 3/4 year = how many months. 3/5 meter= how many centimeters.
at an assembly.180 students sit in 9 equal rows .how many students sit in each row
How do structures in an organism relate to their functions
how do summer conditions affect weathering
How did Andrew Jackson show resilience and toughness thoroughout his life?
What battle was it that the patriots crossed the Delaware river