Although this program does not satisfy the specification exactly, it does do the same job, much better than the program that does satisfy the specification exactly.
#include <stdio.h>
int reverse(void)
{
int c = getchar();
int d;
if (c=='\n' || c==EOF)
return c;
d = reverse();
putchar(c);
return d;
}
int main(void)
{
while (reverse()=='\n')
putchar('\n');
return 0;
}
No comments:
Post a Comment