-
-
Save sirupsen/283580 to your computer and use it in GitHub Desktop.
Quine in C.
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> | |
main() { | |
// String to contain program | |
char *program = "#include <stdio.h>%cmain() {%c char *program = %c%s%c;%c printf(program, 10, 10, 34, program, 34, 10, 10, 10);%c}%c"; | |
/* Insert ascii characters for colon and newline | |
Write out the program, two new lines, at 34 we start colons | |
at the program pointer, in the colons write out the program | |
_again_ stop colons, and paste out some new lines, done! */ | |
printf(program, 10, 10, 34, program, 34, 10, 10, 10); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment