#include < stdio.h > #define MAXLINE 1000 void reverse( char s[]); int getline( char s[], int lim);main() ... { int len; char line[MAXLINE]; while((len = getline(line, MAXLINE)) > 0) ...{ printf("%s", line); reverse(line); printf("%s", line); } return 0;} void reverse( char s[]) ... { int i, j; int length; char c; i = 0; while('/0' != s[i]) ++i; length = i; for(i = length -2, j = 0; i >= length/2; --i, ++j) ...{ c = s[j]; s[j] = s[i]; s[i] = c; }} int getline( char s[], int lim) ... { int c, i; for(i = 0; i < lim - 1 && ((c = getchar()) != EOF && c != '/n'); ++i) s[i] = c; if(c == '/n') ...{ s[i] = c; ++i; } else if(c == EOF && i > 0) ...{ /**//**//**//* gotta do something about no newline preceding EOF */ s[i] = '/n'; ++i; } s[i] = '/0'; return i;}