这么好的一道题,叫我给搞成这样了TT
程序代码:
void change_num(int *a[], int *b[], int m, int n) { int i = 0, j = m - n; while (i < n) *b[i++] = *a[j++]; j = 0; while (j < m - n) *b[i++] = *a[j++]; } #include<stdio.h> int main() { void change_num(int *a[], int *b[], int m, int n); int a[10], b[10]; int i; int *x[10], *y[10]; for (i = 0; i < 10; i++) { x[i] = &a[i]; y[i] = &b[i]; } for (i = 0; i < 10; i++) scanf_s("%d", x[i]); change_num(x, y, 10, 3); for (i = 0; i < 10; i++) printf("%d%c", *y[i], i < 9 ? ' ' : '\n'); return 0; }