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

Which list includes several causes of depression
What is the quotient?7-4ーks130-5○ 75〇fl517 777-7C园燜
what country was mongolia part of in 1900
Which steps will generate an expression equivalent to 14(x + 8)? a.Add x and 8 to get 8x, and then multiply that by 14. b.Multiply each term in the parenthese
his words were cotton candy meaning
would a town near the dessert have low humidity
Which list includes several causes of depression
Whom does nick try to contact after he finds gatsby's body? A. klipspringer B. meyer wolfsheim C. dan cody D. gatsby's father
You are starting a Shaved Ice business and need to decide on a cup. Your choices are between a cone and a cylindrical shaped cup. The cone shaped cup has a di
evidence supporting a claim and counterclaim in an argument can be based on an appeal to emotion. this type of appeal is calleda. ethosb. logosc. pathosd. evide