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
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
Related questions
Question
Solved and run the code in C++ plz
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps with 2 images
Knowledge Booster
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.Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage