Welcome to collectivesolver - Programming & Software Q&A. A website you can trust. All programs tested and works. Contact: aviboots(AT)netvision.net.il
GreenGeeks Web Hosting - Faster, Scalable & Eco-Friendly

BlueHost Web Hosting

Ecommerce Software - Best Ecommerce Platform Made for You - Free Trial

Ecommerce Software - Best Ecommerce Platform Made for You - Free Trial

getflywheel wordpress hosting


Distribute your Resume to 500+ Job Boards & Recruiters


8,090 questions

11,268 answers

573 users

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 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 by avibootz
...