Skip to content

Instantly share code, notes, and snippets.

@ryanseys
Created January 20, 2013 19:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryanseys/4580913 to your computer and use it in GitHub Desktop.
Save ryanseys/4580913 to your computer and use it in GitHub Desktop.
Print a reverse string using no loops in C
#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