voidmerge(int* a, int m, int* b, int n, int* c) { int i=0,j=0,k=0; while(i!=m&&j!=n){ if(a[i]<=b[j]) c[k++]=a[i++]; else c[k++] = b[j++]; } if(i==m){ while(j!=n) c[k++] = b[j++]; } else{ while(i!=m) c[k++] = a[i++]; } }
intmain(int argc, charconst *argv[]) { int m, n, i; int *a, *b, *c; scanf("%d", &m); a = (int*)malloc(m * sizeof(int)); for (i = 0; i < m; i++) { scanf("%d", &a[i]); } scanf("%d", &n); b = (int*)malloc(n * sizeof(int)); for (i = 0; i < n; i++) { scanf("%d", &b[i]); } c = (int*)malloc((m + n) * sizeof(int)); merge(a, m, b, n, c); printArray(c, m + n);