1240: (2025)实验3-4 带数组和指针的函数
Memory Limit:128 MB
Time Limit:1.000 S
Judge Style:Text Compare
Creator:20220002
Submit:1430
Solved:206
Description
编写一个函数void splitArray(int* arr,
int size, int even[], int* evenSize, int odd[], int* oddSize),完成将输入的数组arr拆分为一个存储偶数的数组even和一个存储奇数的数组odd。要求通过指针参数evenSize和oddSize返回偶数数组和奇数数组的实际长度。在主函数中完成输入以及拆分后两个数组的输出。
Input
每组输入分两行,第一行为数组arr的元素个数n,n≤30
第二行为数组arr的具体元素值
Output
第一行输出偶数组
第二行输出奇数组
Sample Input Copy
10
12 46 57 68 23 3 15 30 123 12
Sample Output Copy
12 46 68 30 12
57 23 3 15 123