malloc
1 #include <stdio.h> 2 #include <stdlib.h> 3 4 int main(void) 5 { 6 int number; 7 int *a; 8 int i; 9 printf("请输入数量:"); 10 scanf("%d", &number); 11 //int a[number]; 12 13 a = (int *)malloc(number * sizeof(int)); 14 for (i = 0; i < number; i++) 15 { 16 scanf("%d", &a[i]); 17 } 18 19 for (i = number - 1; i >= 0; i--) 20 { 21 printf("%d\n", a[i]); 22 } 23 24 free(a); 25 return 0; 26 }