2 * 1-19. Write a function reverse(s) that reverses the character string s.
3 * Use it to write a program that reverses its input a line at a time.
6 /* MAXLINE has been reduced for easier testing */
10 int getlin(char line[], int maxline);
11 void copy(char to[], char from[]);
13 void rverse(char s[]);
17 int len; /* current line length */
18 char line[MAXLINE]; /* current input line */
20 while ((len = getlin(line, MAXLINE)) > 0) {
30 for (i=0; s[i] != '\0'; ++i)
41 for (i = 0; i < len/2; ++i) {
48 int getlin(char s[], int lim)
52 for (i=0; i<lim-1 && (c=getchar())!=EOF && c!='\n'; ++i)
61 void copy(char to[], char from[])
65 while ((to[i] = from[i]) != '\0')