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

Friday, 23 Feb 2024 Write down a letter to to arrange freindly another class of To Letter your class teacher, request her football match of your class with scho
What are the highest-rated Pit Boss grills, taking into account performance, durability, features, and customer satisfaction among grill enthusiasts?
The price of a jumper is £ 29. It is reduced by 15 % in a sale. What is the new price of the jumper? Give your answer in pounds ( £ )
Find the value x in the diagram below
decrease 64kg in the ratio of 5 :8​
20 African countries and their CapitalI need quick answers pls ​
Greek influence on Gandhara art was the result of Alexander the Great's invasion of the subcontinent.
please simplify it thank you.The answer is[tex] - \frac{ \sqrt{14} + 3 \sqrt{7} }{14} [/tex]I need the step to do it​
1. Find SP when: (a) CP=920 and gain = 6% EXE ​
The sum of three numbers is 675 400. The first two numbers are 44 500 and 73 819. What is the third number?​