Created
April 27, 2012 21:06
-
-
Save jakeboxer/2513226 to your computer and use it in GitHub Desktop.
C string reverse
This file contains 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
void reverse(char txt[]) { | |
int i, j; | |
char tmp; | |
for (i = 0, j = strlen(txt) - 1; i < j; ++i, --j) { | |
tmp = txt[i]; | |
txt[i] = txt[j]; | |
txt[j] = tmp; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment