/*********reverse: **************** On entry: The standard input stream contains a list of integers, until end of file. On exit: The input will have been read to end of file, and the output will be the input integers in reverse order. */ #include void reverse(void) { int num; if (scanf("%d", &num) < 1) { /* Try to input number. Failure? */ return; /* Error or no data left : Do nothing */ } /* We have the first number. Now ready for the general case. */ reverse(); /* Reverse the rest of the list */ printf(" %d", num); /* Tack the first number on the end */ } /* main function to reverse the overall input */ main() { printf("Please enter a list of integers for reversal:\n"); reverse(); putchar('\n'); /* End the output line */ return 0; }