subject

Suppose a program is supposed to reverse an array. For example, if we have the array arr = {1, 2, 3, 4, 5}, after reversing the array we would have arr = {5, 4, 3, 2, 1}. Most of the code for the program is shown here:
Const int SIZE = 5;
int arr[SIZE] = {1, 2, 3, 4, 5};
int firstindex =0, lastindex = SIZE-1, temp;

1

{
temp = arr[firstindex];
arr[firstindex] = arr[lastindex];
arr[lastindex] = temp;
firstindex++;
lastindex--;
}

All of the following options below could be correctly inserted at line 1 in the code shown above EXCEPT:

a. while(firstindex < lastindex)
b. while(firstindex <= lastindex)
c. for(int i=0; i<(SIZE/2-1); i++)
d. for(int i=0; i<(SIZE/2); i++)

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 22:30
This isn’t really school related, but like where the heck can you find manga, to read to where you don’t have to pay money, for points? my friend wants me to read bj alex, and i can’t find it anywhere for free.
Answers: 2
question
Computers and Technology, 22.06.2019 23:00
Which factor is the most important when choosing a website host? whether customers will make secure transactions the number of email accounts provided the purpose of the website the quality of the host control panel
Answers: 3
question
Computers and Technology, 23.06.2019 07:00
1. you have a small business that is divided into 3 departments: accounting, sales, and administration. these departments have the following number of devices (computers, printers, etc.): accounting-31, sales-28, and administration-13. using a class c private network, subnet the network so that each department will have their own subnet. you must show/explain how you arrived at your conclusion and also show the following: all available device addresses for each department, the broadcast address for each department, and the network address for each department. also, determine how many "wasted" (not usable) addresses resulted from your subnetting (enumerate them).
Answers: 3
question
Computers and Technology, 23.06.2019 17:30
Write pseudocode to represent the logic of a program that allows the user to enter a value. the program multiplies the value by 10 and outputs the result.
Answers: 1
You know the right answer?
Suppose a program is supposed to reverse an array. For example, if we have the array arr = {1, 2, 3,...
Questions
question
History, 18.12.2020 23:40
question
Mathematics, 18.12.2020 23:40
Questions on the website: 13722367