#include<iostream.h>
#include<conio.h>
void Concatenation(int a[],int m,int b[],int n,int c[])
{
int p=0,i=0,j=0;
while(i<m)
c[p++]=a[i++];
while(j<n)
c[p++]=b[j++];
}
void main()
{
clrscr();
int a[50],b[50],c[100],i,n,m;
cout<<"Enter the number of elements for two arrays";
cin>>m>>n;
cout<<"Enter the elements in 1st array";
for(i=0;i<m;i++)
{
cin>>a[i];
}
cout<<"Enter the elements in 2nd array";
for(i=0;i<n;i++)
{
cin>>b[i];
}
Concatenation(a,m,b,n,c);
cout<<"Element in new array are";
for(i=0;i<(m+n);i++)
{
cout<<c[i]<<",";
}
getch();
}
#include<conio.h>
void Concatenation(int a[],int m,int b[],int n,int c[])
{
int p=0,i=0,j=0;
while(i<m)
c[p++]=a[i++];
while(j<n)
c[p++]=b[j++];
}
void main()
{
clrscr();
int a[50],b[50],c[100],i,n,m;
cout<<"Enter the number of elements for two arrays";
cin>>m>>n;
cout<<"Enter the elements in 1st array";
for(i=0;i<m;i++)
{
cin>>a[i];
}
cout<<"Enter the elements in 2nd array";
for(i=0;i<n;i++)
{
cin>>b[i];
}
Concatenation(a,m,b,n,c);
cout<<"Element in new array are";
for(i=0;i<(m+n);i++)
{
cout<<c[i]<<",";
}
getch();
}