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

if Sandy can afford car payments of $140/month for 4 years what is the price of a car that she can afford now?
how to draw a model for.4x.5
Why is farming easiest in Midwest region
Describe the relationship between the values of the digits in 9,999,999
give me five reason why do we have to study biology?
What does −|−9| mean
Girls can drink less than guys over less time and still have damage to there oragams
Please help me with # 21 ! Sorry, the picture is a little blurry. It says There are magnificent, fragrant roses in the garden. Find the simple predicate.
How many points determine a unique line? A. 1 point B. 2 points C. any 3 points D. 3 noncollinear points
Greater than or less than?