1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
juin [17]
3 years ago
6

Reversing the elements of an array involves swapping the corresponding elements of the array: the first with the last, the secon

d with the next to the last, and so on, all the way to the middle of the array. Given an array a and two other int variables, k and temp, write a loop that reverses the elements of the array. Do not use any other variables besides a, k, and temp.
Computers and Technology
1 answer:
Ksivusya [100]3 years ago
4 0

Answer:

// Assume that all variables a, n, temp have been declared.

 // Where a is the array, n is the array length, temp is a temporary

 // storage location.

 // Cycle through the array a.

 // By the time the loop gets halfway,

 // The array would have been reversed.

 // The loop needs not get to the end of the array.

 // Hence, the loop ends halfway into the array i.e n/2.

 for (int k = 0; k < n / 2; k++) {

   

  // Swap first and last, second and next-to-the-last and so on

  temp = a[k];

  a[k] = a[n - k - 1];

  a[n - k - 1] = temp;

 }

Explanation:

Carefully go through the comments in the code.

Hope this helps!

You might be interested in
Quinton is having trouble learning Spanish because he keeps reverting back to the grammatical structures of his native English l
GuDViN [60]

Answer: Proactive interference

Explanation: Proactive interference is the situation where an individual is not able to retain or memorize the new memories due to the hindrance of the past memories. The past memories hold back in the mind of an individual so that new information cannot completely take place in mind.

Other options are incorrect because provocative interference is not a interference term, retroactive interference does not let an individual remember the past information due to new memories and verbal interference is type of interference that creates hindrance usually in the game field .Thus, the correct option is proactive interference.

7 0
3 years ago
C program To print odd numbers from 15 to 1 ​
inn [45]

Answer:true

Explanation:

This statement is correct

4 0
3 years ago
Sypherpk is good go sub 2 him
attashe74 [19]

Answer:

Ok

Explanation:

I will check him out, do you need anything else though?

4 0
3 years ago
Read 2 more answers
A_____refers to the entire Excel file
Veronika [31]
Answer:  workbook

Explanation:
A workbook is the file that holds several worksheets.
The worksheets within a workbook can communicate with each other within the workbook or with other workbooks and their worksheets.
A worksheet within a workbook holds cells that are defined by rows and columns. Worksheets within a workbook can removed and new worksheets can be added.
8 0
3 years ago
What customization feature can you use to create a cohesive look and feel for your presentations
yan [13]

B.Custom Themes

I have to add text so I can post this answer

5 0
3 years ago
Other questions:
  • Write a function that takes an array of integers and its size as parameters and prints the two largest values in the array. In t
    5·1 answer
  • When inside a closed work environment, its okay to openly talk with co-workers about PII
    6·1 answer
  • You are troubleshooting an interface issue on your cisco ios isr. the output of "show ip interface brief" indicates that etherne
    11·1 answer
  • What does it mean to search an index or the web? (DONT TAKE ANSWERS FROM THE INTERNET!)
    9·2 answers
  • Who innovated an aeroplane? ​
    5·1 answer
  • if you were determining what was expected of you simply by looking at media, what messages would you take away?
    8·2 answers
  • Write short notes about monitor printer and speaker​
    14·2 answers
  • What should be entered to make the loop print
    6·1 answer
  • PLS HELP ASAP!! which of these would be easier to do in a database program than a spreadsheet program? check all of the boxes th
    5·2 answers
  • Select the correct answer from each drop-down menu. A company is recruiting for a web designer. What kind of candidate should th
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!