Here(note - untested for syntax, but it should work):[tt]
reverse(s) /* reverses strings in place */
char *s;
{
char c, *t;
int linelen();
for (*t = s + linelen(s) - 1; s < t; s++, t--)
{
c = *s;
*s = *t;
*t = c;
}
}
linelen(s)
char *s;
{
char *p = s;
while ( (*p) && (*p != '\n') )
p++;
return(p-s);
}
[/tt]
call it with a while loop(you supply readline or an equivelent):[tt]
char *s;
while ( s = readline() )
{
reverse(s);
printf("%s", *s);
}
[/tt] and voilá.
the logic is as follows: s starts at the first element of the array, t starts at the last, not including the '\0' or the '\n'. then, their values will be switched. lastly, s and t will each be incremented one towards the middle until they pass each other, thus switching all the characters.
HTH "If you think you're too small to make a difference, try spending a night in a closed tent with a mosquito."