Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is what I have so far but I have come across multiple errors. I think i need to dynamically allocate the new array. Please

image text in transcribed
This is what I have so far but I have come across multiple errors. I think i need to dynamically allocate the new array. Please provide comments throughout the program(This is why I did this etc)
C++ Programming
Here is what I have so far
#include
#include
using namespace std;
int* getArray(int array, int ARRAY_SIZE)
//The size of the array and array placeholder
{
int num[ARRAY_SIZE]; //The combination of numbers and arrau
int a, b = 0; //A and B used as the separate array integers
for (a = 0; a
{
num[a] = array[a]; //Copying the array A with a different array
}
for (a = array_size - 1; a >= 0; a--)
{
array[b++] = num[a]; //Having b=a in transfer
}
return array; //Pointer to store the array itself
}
int main() //Start of Program
{
const int SIZE = 6;
int nums[SIZE] = { 3, 4, -7, 6, 9, -2 };
int* numArr = nums;
//int* num; //Call the getArray function to get pointer
num = getArray(*nums, SIZE);
printf("Array outside function in reverse form "); //Printf is formatting the function
for (int a = 0; a
{
printf("%d\t", num[a]); //Helps with the spacing
}
return 0; //End of program
}
Reverse Array Write a function that accepts an int array and the array's size as arguments. The function should create a copy of the array, except that the element values should be reversed in the copy. The function should return a pointer to the new array. Demonstrate the function in a complete program

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

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

3. describe how to recognize disordered eating,

Answered: 1 week ago