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

Need an answer fast please!! Sam said the square root of a rational number must be a rational number. Jenna disagreed. She said that it is possible that the squ
Need help on this question please thank you
_____ (i ask for) un vestido nuevo. pregunta pides pregunto pido
HELP PLZ & EXPLAINTrapezoid TUVW is shown on the coordinate plane below: If trapezoid T'U'V'W' represents trapezoid TUVW reflected over the y-axis, the orde
Milton Friedman helped to establish the economic theory of monetarism.Which statement best describes the idea of monetarism?(A) Aggregate supply and demand can
Which equation using x to represent time best represents the floor number of an elevator descending at a steady rate? a. y= -75+2x b. y=-75-2x c. y=75-2x d. y=7
In this excerpt from ode on a Grecian by John keets which four parts reflect the theme that art is immortal
Need help please !!!!!!
Which of the following values of u makes u(2 + u) – 2u = 16 true?
Find the intercepts for the graph of the equation given 4x-7y=28