Created
December 17, 2015 00:23
-
-
Save rhaps0dy/d4c95142d5a5dd6bccff to your computer and use it in GitHub Desktop.
Quine 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 f(char*b){while(*b){if(*b=='"'||*b=='\\')putchar('\\');if(*b=='\n') printf("\\n"),b++; else putchar(*b++);}} | |
void g(char *c){printf("%s", c); putchar('"'); f(c); printf("\");}\n");} | |
int main(){g("#include<stdio.h>\nvoid f(char*b){while(*b){if(*b=='\"'||*b=='\\\\')putchar('\\\\');if(*b=='\\n') printf(\"\\\\n\"),b++; else putchar(*b++);}}\nvoid g(char *c){printf(\"%s\", c); putchar('\"'); f(c); printf(\"\\\");}\\n\");}\nint main(){g(");} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment