c语言(升序数组的合并),怎么解决?
include <stdio.h
include <stdlib.h
include <malloc.h
//c合并升序数组a,b并存在c数组中
void uparr(inta,int m,int
void merge(int* a, int m, int* b, int n, int* c)
{
int i=0,j=0,k=0;
while(i<m&&j<n)
{
if(*a>=*b)
{
c[k]=*b;
b++;j++;k++;
}
else
{
c[k]=*a;
a++;i++;k++;
}
}
if(i<m)
{
while(k<=m+n-1)
{
c[k]=*a;
a++;
k++;
}
}
if(j<n)
{
while(k<=n+m-1)
{
c[k]=*b;
b++;
k++;
}
}
}