Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Trying to do this in C++ Question 3: In this question, you will write four versions of a function getPosNums that gets an array of

Trying to do this in C++

image text in transcribed

Question 3: In this question, you will write four versions of a function getPosNums that gets an array of integers arr, and its logical size. When called it creates a new array containing only the positive numbers from arr For example, if arr= [3 containing the following 3 elements: [3, 6, 4], .1, -3, 0, 6, 41, th, iunciions should cinate an array , The four versions you should implement differ in the way the output is returned The prototypes of the functions are: a) int* getPosNums1 (int* arr, int arrSize, int& outPosArrSize) returns the base address of the array (containing the positive numbers), and updates the output parameter outPosArrSize with the array's logical size. b) void getPosNums2 (int* arr, int arrSize, int*& outPosArr, int& outPosArrSize) updates the output parameter outPosArr with the base address of the array (containing the positive numbers), and the output parameter outPosArrSize with the array's logical size. c) int*getPosNums3 (int* arr, int arrSize, int* outPosArrSizePtr) returns the base address of the array (containing the positive numbers), and uses r to update the array's logical size. d) void getPosNums 4 (int* arr, int arrSize, int outPosArrPtr, int* outPosArrSizePtr) uses the pointer outPosArrPtr to update the base address of the array (containing the positive numbers), and the pointer outPosArrSizePtr to update the array's logical size. Note: You should also write a main program that calls and tests all these functions

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