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 are some important historical facts write in your own words
|5x-8|+5=32 Can I get help setting up this equation and can you break it down
The temperature this morning was −12 °C. This afternoon, the temperature dropped by 6 degrees. What is the new temperature?
Help me on this question it should be easy but I just wanna make sure ;)
Si Units Worksheet. Use si units to complete
What is a monarchy? plz helppp
how are each term related to one another in the sequence 2,90,4,87,6,12,8,51,10 ?​
alguien que me ayude??? porfis ​
The quotient of the absolute value of negative six squared and three
What is the mass (in grams) of 8.11×1026 CO2 molecules?