题解 | #逆序输出#
逆序输出
https://www.nowcoder.com/practice/bb66c27cb7aa48f9ba7d9f88e4068285
#include <stdio.h> int main() { int a; int arr[10] = {0}; while(scanf("%d ", &a) != EOF) { static int i = 0; //用static静态变量i只初始化一次,保证i不被重置0 arr[i] = a; //输入10个数放入数组中 i++; } for (int i = 9; i >=0; i--) { //从后往前遍历数组元素 printf("%d ",arr[i]); } printf("\n"); return 0; }