Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A) Fix any errors to get the following program to run in your environment. B) Document each line of code with comments and descibe any

A) Fix any errors to get the following program to run in your environment. B) Document each line of code with comments and descibe any changes you had to make to the original code to get it to work. C) Write a summary of what your final version of the program does. You may also add white space or reorder the code to suit your own style as long as the intended function does not change. #include

using namespace std;

const int SIZE 4;

void printArray(int list[], int arraySize);

void reverse(const int list[], int newList[], int size)

{

for (int i = 0, j = size - 1; i < size; i++, j--)

{

newList[j] = list[i];

}

}

void p(const int list[], int arraySize)

{

list[0] = 100;

}

int main()

{

SIZE = 4;

int newList[SIZE];

int numbers[] = { 1, 4, 3, 6, 8 };

p(numbers, 5);

printArray(numbers, 5);

reverse(list, newList, SIZE);

printArray(newList, SIZE);

return 0;

}

void printArray(int list[], int arraySize)

{

for (int i = 0; i < arraySize; i++)

{

cout << list[i] << " ";

}

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

a. How will the leader be selected?

Answered: 1 week ago