#include<stdio.h>#include <stdlib.h>int *wuli(int *pa, int a,int *pb,int b){ int *pc = (int *)malloc(sizeof(int)*(a + b)); for (int i = 0; i < a; i++) { pc [i]= pa[i]; } for (int i = 0; i < b; i++) { pc[i+a] = pb[i]; } return *pc;}void main(){ int a, b; printf("a的长度是多少 "); scanf("%d", &a); int *pa = malloc(sizeof(int)*a); for (int i = 0; i < a; i++) { scanf("%d",& pa[i]); } printf("b的长度是多少 "); scanf("%d", &b); int *pb = malloc(b*sizeof(int)); for (int i = 0; i < b; i++) { scanf("%d", &pb[i]); } int *p=wuli(&pa, a, &pb, b); for (int i = 0; i < a + b; i++) { printf("%d", p[i]); } system("pause");}
目前暂无任何回答
- 0 回答
- 0 关注
- 1227 浏览
添加回答
举报
0/150
提交
取消