Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A.Reverse Array Write a function that accepts an int array and the arrays size as arguments. The function should create a copy of the array,

image text in transcribed

A.Reverse Array Write a function that accepts an int array and the arrays 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.

B. Array Expander:

Write a function that accepts an int array and the array s size as arguments. The

function should create a new array that is twice the size of the argument array. The

function should copy the contents of the argument array to the new array, and initialize

the unused elements of the second array with 0. The function should return a

pointer to the new array.

C. Element Shifter

Write a function that accepts an int array and the array s size as arguments. The

function should create a new array that is one element larger than the argument array.

The rst element of the new array should be set to 0. Element 0 of the argument array

should be copied to element 1 of the new array, element 1 of the argument array

should be copied to element 2 of the new array, and so forth. The function should

return a pointer to the new array.

Programming language: C++

Make sure to declare and initialize the original array inside of main AND THEN call a function to reverse the array and then call another function to expand the array and then call a third function to shift the array. The functions to reverse, expand and shift have to be separate. Each function will return a pointer to the new array that was generated. Main will then call a displayArray function (3 separate times) to display each new array. Here's how d like it organized: prototypes mainO declare array declare the pointers reversePointer -reverseArray(array, SIZE) expandPointer expandArray(array, SIZE) shiftPointer shiftArrayarray, SIZE) displayArray(reversePointer, SIZE) displayArray(expandPointer, SIZE) displayArray(shiftPointer, SIZE) You cannot just display the dynamically-created arrays in the functions that created them. You MUST display the arrays after the functions have returned their pointer to main. To help us grade, let's initialize the firstArray to 3,6,9,12,15,18,21,24,27,30

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_2

Step: 3

blur-text-image_3

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

Database Horse Betting The Road To Absolute Horse Racing 2

Authors: NAKAGAWA,YUKIO

1st Edition

B0CFZN219G, 979-8856410593

More Books

Students also viewed these Databases questions

Question

What is the basis for Security Concerns in Cloud Computing?

Answered: 1 week ago

Question

Describe the three main Cloud Computing Environments.

Answered: 1 week ago