Created
June 14, 2013 18:09
-
-
Save rudolph9/5784015 to your computer and use it in GitHub Desktop.
reverses a string
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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