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 substance is made during transcription and where does it occur
write the equation in function form then graph the equation 3x-y=5
write the equation in function form.then graph the equation y-x=-1
He believed that while there is serious unemployment in our auto industry, we should not ________ foreign cars. (A) build (B) repair (C) review (D) import (E) c
algae do not cause disease or not
What Is the National Prohibition Act?
What area of the long bone is covered with cartilage
you are building a birdhouse that will have a volume of 128 in^3. the birdhouse will have the dimensions shown a. write a polynomial that represents the volume
Can someone help me please got to be in tomorrow
First year profits of a business were $900 . Second year profits were $1200 . What percent of the first year profits were the second year profits.