大佬帮忙看看代码哪里有问题,数组合并不成功,求中位数也没有成功的原因。
```c
#include "stdio.h"
int main()
{
int nums1[] = {1,2,3,4,5,6,7,8,9,10};
int nums2[] = {11,12,13,14,15,16,17,18,19,20};
//定一个空数组来装整个
int array[]={};
int Length_Size1 = sizeof nums1 / sizeof nums1[0];
int Length_Size2 = sizeof nums2 / sizeof nums2[0];
int Length_Size3 = ( sizeof nums1 / sizeof nums1[0]) + (sizeof nums2 / sizeof nums2[0]);
printf("Length_Size1:%d\n",Length_Size1);
printf("Length_Size2:%d\n",Length_Size2);
printf("Length_Size3:%d\n",Length_Size3);
//合并数组
for(int i = 0; i< Length_Size1;i++)
{
array[i]= nums1[i];
}
for(int i = 0;i < Length_Size2;i++)
{
array[Length_Size1+i] = nums2[i];
}
for(int i = 0; i < Length_Size3;i++)
{
printf("array[%d] = %d\n",i,array[i]);
}
for(int i = 0; i <= Length_Size3;i++)
{
if((sizeof array) / 2 == 0)
{
printf("%d\n",array[(sizeof array / 2)] + array[(sizeof array / 2 )+1]);
}
else if((sizeof array) / 2 != 0)
{
printf("%d\n",array[(sizeof array / 2)+1]);
}
}
return 0;
}
```