Skip to content

Instantly share code, notes, and snippets.

@bryanwb
Created March 3, 2010 11:13
Show Gist options
  • Select an option

  • Save bryanwb/320541 to your computer and use it in GitHub Desktop.

Select an option

Save bryanwb/320541 to your computer and use it in GitHub Desktop.
/* reverse: reverse string s in place */
void reverse(char *s)
{
int j = 0;
int temp = 0;
char *i = s;
s += strlen(s) - 1;
while (s != i){
temp = *i;
*i = *s;
*s = temp;
i++, s--;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment