c语言 数组合并
#include<stdio.h> int main() { int m,n,i,j,k; printf("Enter no. of elements in array1:\n"); scanf("%d",&m); int arr[m]; printf("Enter array elements:\n"); for(i=0;i<m;i++) scanf("%d",&arr[i]); printf("Enter no. of elements in array2:\n"); scanf("%d",&n); int arr1[n]; printf("Enter array elements:\n"); for(j=0;j<n;j++) scanf("%d",&arr1[j]); int arr2[m+n]; for(i=0;i<m;i++) arr2[i]=arr[i]; for(j=0;j<n;j++) arr2[m+j]=arr1[j]; printf("Array Elements after merging array:\n"); for(i=0;i<m+n;i++) printf("%d ",arr2[i]); printf("\n"); }