Question 3 Create a function called reduce • Inputs are the starting address of an integer array and the size of the array • Dynamically allocate memory for a new array half the size of the inputted array Using a loop place every other element from the inputted array into the newly created Return the address of the new array Create a function called print Inputs are the starting address of an integer array and the size of the array -Using a loop print out all the elements from the inputted array In the main function Create the following integer array int x[] = {3,5,21,45,16,19); Use the reduce function to reduce the size of the array x Use the print function to print out the array x and the reduced version of x Free up all allocated memory %3D Use function prototypes and pointer notation for all arrays. Output example 35214516 19 321 16

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter8: Arrays And Strings
Section: Chapter Questions
Problem 23PE
icon
Related questions
Question
Solved and run the code in C++ plz
A Moving to the next question prevents changes to this answer.
Question 3
Create a function called reduce
Inputs are the starting address of an integer array and the size of the array
Dynamically allocate memory for a new array half the size of the inputted array
• Using a loop place every other element from the inputted array into the newly created a
Return the address of the new array
Create a function called print
Inputs are the starting address of an integer array and the size of the array
Using a loop print out all the elements from the inputted array
In the main function
Create the following integer array int x[] = {3,5,21,45,16,19)3;
Use the reduce function to reduce the size of the array x
Use the print function to print out the array x and the reduced version of x
Free up all allocated memory
Use function prototypes and pointer notation for all arrays.
Output example
35 21 45 16 19
321 16
TTTT
Paragraph v
Arial
3 (12pt)
T
fx
圍
Mashups
III
>
Transcribed Image Text:A Moving to the next question prevents changes to this answer. Question 3 Create a function called reduce Inputs are the starting address of an integer array and the size of the array Dynamically allocate memory for a new array half the size of the inputted array • Using a loop place every other element from the inputted array into the newly created a Return the address of the new array Create a function called print Inputs are the starting address of an integer array and the size of the array Using a loop print out all the elements from the inputted array In the main function Create the following integer array int x[] = {3,5,21,45,16,19)3; Use the reduce function to reduce the size of the array x Use the print function to print out the array x and the reduced version of x Free up all allocated memory Use function prototypes and pointer notation for all arrays. Output example 35 21 45 16 19 321 16 TTTT Paragraph v Arial 3 (12pt) T fx 圍 Mashups III >
Expert Solution
steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
ADT and Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage