#include<iostream>
using namespace std;
class array
{
    public:
        int size;
        int *A;
};
    for(;j<arr2->size;j++)
    {
        arr3.A[k++]=arr2->A[j];
        length++;
    }
    for(int a=0;a<length;a++)
    {
        cout << arr3.A[a];
    }
}
int main()
{
    array arr1,arr2;
    cout<<"Enter the size of the array 1 :\n";
    cin>> arr1.size;
    arr1.A = new int(arr1.size);
    cout<<"Enter the elements in the array 1 :\n";
    for(int i=0;i<arr1.size;i++)
    {
        cin>>arr1.A[i];
    }
    cout<<"Enter the size of the array 2 :\n";
    cin>> arr2.size;
    arr2.A = new int(arr2.size);
    cout<<"Enter the elements in the array 2 :\n";
    for(int i=0;i<arr2.size;i++)
    {
        cin>>arr2.A[i];
    }
    set_union(&arr1,&arr2);
}
This is my code to implement union of arrays but in my ide after taking the input of size of second array, program gets stuck or gets terminated. I mean , it doesn't go to the part where the program ask user to put elements in the array. Problem starts after the statement where it ask to put the size of the array 2.
