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
//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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started