Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!