/* merge.c -- Given two sorted sequences of integers, it creates * a sorted sequence consisting of all their numbers. */ #include #define NMAX 10 void printIntArray(int a[], int n); void merge(int c[], int *nc, int a[], int na, int b[], int nb); int main(void) { int x[NMAX] = {1,3,5,6,7}; /* The first sorted sequence */ int y[NMAX] = {2,3,4}; /* The second sorted sequence */ int z[NMAX+NMAX]; /* The merge sequence */ int nz; merge(z,&nz,x,5,y,3); printIntArray(z,nz); } void printIntArray(int a[], int n) /* n is the number of elements in the array a. * These values are printed out, five per line. */ { int i; for (i=0; i