The following program splits an array into two different arrays of equal length.
Language : C
[sourcecode language='c']
//Spliting an Array
#include
#include
void main()
{
int sa[20],a[10],b[10],j,i,size,n;
clrscr();
printf(“Enter the size of Array”);
scanf(“%d”,&size);
printf(“\nEnter elements of the Array”);
for(i=0;i
n=size/2;
i=0;
for(j=0;j
a[j]=sa[i];
i++;
}
i=n;
for(j=0;j
b[j]=sa[i];
i++;
}
printf(“\n The 1st splited array:”);
for(j=0;j<=n-1;j++)
printf(“%d\t”,a[j]);
printf(“\n The 2nd splited array:”);
for(j=n;j
}
[/sourcecode]






