Created
January 20, 2013 19:16
-
-
Save ryanseys/4580913 to your computer and use it in GitHub Desktop.
Print a reverse string using no loops in C
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
#include <stdio.h> | |
void print_s_r(const char * s) { | |
if(*s != 0) { | |
print_s_r(s+1); | |
putchar(*s); | |
} | |
} | |
int main() { | |
print_s_r("Hello World!\n"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment