Skip to content

Instantly share code, notes, and snippets.

@mina86
Created May 4, 2011 23:33
Show Gist options
  • Save mina86/956241 to your computer and use it in GitHub Desktop.
Save mina86/956241 to your computer and use it in GitHub Desktop.
Self printing C program
#include <stdio.h>
int main() {
const char *fmt = "#include <stdio.h>%c%cint main() {%c const char *fmt = %c%s%c;%c printf(fmt, 10, 10, 10, 34, fmt, 34, 10, 10, 10, 10);%c return 0;%c}%c";
printf(fmt, 10, 10, 10, 34, fmt, 34, 10, 10, 10, 10);
return 0;
}
@OpenGrid
Copy link

OpenGrid commented May 5, 2011

@mina86
Copy link
Author

mina86 commented May 5, 2011 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment