C++实现两个有序数组的合并

#include
using namespace std;

int *SortArry(int *StrA,int lenA, int *StrB, int lenB)
{
  if (StrA == NULL || StrB == NULL)
  return NULL;

 int *StrC = new int[lenA + lenB+1];

 int i = 0, j = 0, k = 0;
 while (i < lenA && j < lenB)
 {
     if (StrA[i] < StrB[j])
         StrC[k++] = StrA[i++];
     else
	  {
	   StrC[k++] = StrB[j++];
	  }
 }

 while (i

 

你可能感兴趣的:(c/c++)