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 need help with number 4
According to the American colonists a government is only legitimate if it has
The population of fish in a certain lake follows the logistic growth function f(t)=25000/1+8.25e^-0.076 where t is the time in years. According to the growth mo
Yellow bone marrow is composed primarily of A. immature erythrocytes. B. fibrous connective tissue. C. immature leukocytes. D. fat cells.
Simplify all of the below1.) 3√10+7√15-6√10-4√152.)5√7+12√6-10√7-5√63.)7√3-4√6+√48-√544.)3√5-2√7+45-√285.) √10 * √8
Are the Alliance better than the Horde Vote here now!!!! it matters show faction pride Plus points for the first two answers!!!
which of the following men does not support reparations for African Americans: Coates, Robinson, Conyers
I need help on this question
Please answer fast 1. Each week, Bart earns a base rate of $85 and a commission on each dollar of merchandise he sells. If Bart sells $3600 in one week and c r
What is the length of MO¯?