Reference no: EM132210344
Question : Write a program that include the following function:
void insert0(int n, int a1[], int a2[]);
that has as input an integer array a1[] of length n and as output an integer array a2[] of length 2n. The function copies the input array to the output array, inserting the value 0 between each copied value.
Thus, if a1[] contains the values -9, 16, 0, 2, the output array a2[] should have the values -9, 0, 16, 0, 0, 0, 2, 0.
In the main function, ask the user to enter the length of the input array, declare the input and output arrays, read in the values for the input array, and call the insert0 function to compute the output array.
The main function should display the result of the output array.
Enter the length of the array: 5
Enter the elements of the array: 3 4 9 1 4
Output:
The output array is: 3 0 4 0 9 0 1 0 4 0