Question: Write a C + + program to create 2 arrays below: int array 1 [ ] = { 1 , 2 , 3 , 4

Write a C++ program to create 2 arrays below:
int array1[]={1,2,3,4,5};
int size1= sizeof(array1)/ sizeof(int);
int array2[]={4,5,6,7,8};
int size2= sizeof(array2)/ sizeof(int);
Then write a function that takes two pointers to the above arrays and their sizes as arguments. The function should return a pointer to a new array that contains the combination of the elements of the two input arrays. The function should also modify the size argument to be the size of the new array. Use below function prototype:
int* unionArrays(int* array1, int size1, int* array2, int size2, int& size)
To remove the duplicate, you may use Boolean data type declaration below:
bool isDuplicate = false;
Sample IO format of the program is as shown below:
New array: 12345678
Size of the new array: 8
 Write a C++ program to create 2 arrays below: int array1[]={1,2,3,4,5};

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!