Question: Program using C. 1. Write a program merge.c that include the following function: void merge(int n, int a1[], int a2[], int a3[]); that has a

Program using C.

1. Write a program merge.c that include the following function:

void merge(int n, int a1[], int a2[], int a3[]);

that has a parameter as an integer array a1[] of length n and another parameter an integer array a2[] of length n. The function merges the contents of the two integer arrays a1 and a2 to a3. Thus, if a1[] contains the values -9, 16, 0, 2, and a2[] contains 1, 3, 5, 4, then make a3 equal to -9, 1, 16, 3, 0, 5, 2, 4. Nothing is returned.

In the main function, ask the user to enter the length of the arrays, declare the arrays, read in the values for the two arrays, and call the merge function to compute the third array. The main function should display the result of the third array.

Enter the length of the array: 3

Enter the elements of the first array: 3 4 9

Enter the elements of the second array: 7 2 1

Output: The output array is: 3 7 4 2 9 1 2.

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 Databases Questions!