#include "stdio.h"
void merge(int la[], int lal, int lb[], int lbl, int *lc);
void main( void )
{
int i = 0;
int la[] = {2, 4, 6, 8, 10};
int lb[] = {1, 3, 5, 7, 9};
int lc[10] = {0};
merge(la, 5, lb, 5, &lc);
for(i = 0; i<10; i++)
{
printf("\n%d",lc[i]);
}
}
void merge(int la[], int lal, int lb[], int lbl, int *lc)
{
int i = 0;
int j = 0;
int k = 0;
while(i < lal && j < lbl)
{
lc[k++] = la[i] < lb[j] ? la[i++] : lb[j++];
}
while(i < lal)
{
lc[k++] = la[i++];
}
while(j < lbl)
{
lc[k++] = lb[j++];
}
}