Question: Program using C. Modify merge.c, the merge function using pointer arithmetic. The function prototype should be the following. Name your program merge2.c. void merge(int n,

Program using C.

Modify merge.c, the merge function using pointer arithmetic. The function prototype should be the following. Name your program merge2.c.

void merge(int n, int *a1, int *a2, int *a3);

Note: This program will be based on whether the required functionality were implemented correctly (using pointer arithmetic) instead of whether it produces the correct output, for the functionality part

The function should use pointer arithmetic not subscripting to visit array elements. In other words, eliminate the loop index variables and all use of the [] operator in the function.

#include #include #include

//Function which merge the two arrays and make third array void merge(int n, int a1[], int a2[], int a3[]);

int main() { //Declaring variables int n,i; //getting the size of an array printf("Enter the length of an array :"); scanf("%d",&n); //Creating an Arrays based on user entered size int a1[n]; int a2[n]; int a3[2*n]; //Getting the elements of an first array printf("Enter the elements of the first array: "); for(i=0;i

//Getting the elements of an second array printf("Enter the elements of the second array: "); for(i=0;i

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!