How to write the shortest program that print a copy of its own in C

2 Answers

0 votes
#include <stdio.h>     

main() { char *s="main() { char *s=%c%s%c; printf(s,34,s,34); }"; printf(s,34,s,34); } 

/*
run:

main() { char *s="main() { char *s=%c%s%c; printf(s,34,s,34); }"; printf(s,34,s,34); }

*/

 



answered May 14, 2018 by avibootz
0 votes
#include <stdio.h>     

main(s){printf(s="main(s){printf(s=%c%s%c,34,s,34);}",34,s,34);}

/*
run:

main(s){printf(s="main(s){printf(s=%c%s%c,34,s,34);}",34,s,34);}

*/

 



answered May 14, 2018 by avibootz
...