/* * Program to reverse list of integers from stdin, using an array and loops. */ #include #define ARRAY_SIZE 20 int main(void) { printf("enter integers, anything else to stop\n"); int input; int count = 0; int nums[ARRAY_SIZE]; while (scanf("%d", &input) == 1) { if (count == ARRAY_SIZE) { printf("array size exceeded\n"); return 1; } nums[count++] = input; } for (int i = count-1; i >= 0; --i) { printf("%d\n", nums[i]); } return 0; }