Question: what is java script Q16; Write a function named grow that takes an array of integers and the array's size as arguments. It should create

what is java script

Q16;

Write a function named grow that takes an array of integers and the array's size as arguments. It 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 so that each element from the first array occurs twice consecutively in the second array. For example, grow(x,3) where x is {4,5,6} should return {4,4,5,5,6,6}. The function should return a pointer to the new array. Write a main function to demonstrate your function. Assume the input will be a sequence of numbers, the first number will be a count of how many numbers follow. Input the values in the array and call grow on it. Output the values of the result of the call to grow. Be sure to deallocate any dynamically allocated memory! If the input is 3 4 5 6 the output should be 4 4 5 5 6 6 If the input is 9 1 2 3 4 5 6 7 8 9 the output should be 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!