Skip to content

Instantly share code, notes, and snippets.

@Aaron1011
Created November 23, 2012 19:06
Show Gist options
  • Save Aaron1011/4136867 to your computer and use it in GitHub Desktop.
Save Aaron1011/4136867 to your computer and use it in GitHub Desktop.
int reverse(char s[])
{
int len, i;
char copied[MAXLINE];
copy(copied, s);
for (len = 0; ; ++len)
if (s[len] == '\n')
break;
for (i = 0; i <= len; ++i)
if (copied[i] == '\n')
break;
s[len - i] = copied[i];
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment