#include "stdio.h" #define Num 100 void reverse(char words[])
{
int i, j, c, n=0;
while(words[n]!='\0')
n++; for(i=0,j=n-1;i<j;i++,j--)
{
c = words[i];
words[i] = words[j];
words[j] = c;
}
} int main()
{
char words[Num]={0}; int c,i = 0; while((c = getchar()) != EOF)
{
words[i] = c;
i++;
}
reverse(words); printf("%s\n",words); return 0; }
反转字符串。