Skip to content

Instantly share code, notes, and snippets.

@rudolph9
Created June 14, 2013 18:09
Show Gist options
  • Save rudolph9/5784015 to your computer and use it in GitHub Desktop.
Save rudolph9/5784015 to your computer and use it in GitHub Desktop.
reverses a string
#include <stdio.h>
#include <string.h>
int main ()
{
char str0[]="Hello world";
char str1[40];
int str0_length = strlen(str0);
int i;
for( i = 1 ; i <= str0_length ; i++)
str1[i - 1] = str0[ str0_length - i];
printf ("%s\n",str1);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment