- 注册时间
- 2008-6-19
- 最后登录
- 1970-1-1
- 威望
- 星
- 金币
- 枚
- 贡献
- 分
- 经验
- 点
- 鲜花
- 朵
- 魅力
- 点
- 上传
- 次
- 下载
- 次
- 积分
- 1806
- 在线时间
- 小时
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?欢迎注册
×
http://wxx.cs.hit.edu.cn/?p=138
Author: Unknown (from The Jargon File)
Notes: The first several examples are variations of the standard one-liner C quines.
main(){char *c="main(){char *c=%c%s%c;printf(c,34,c,34);}";printf(c,3
4,c,34);}
Author: Joe Miller
Notes: This causes some warnings but should compile fine.
p="p=%c%s%c;main(){printf(p,34,p,34);}";main(){printf(p,34,p,34);}
Author: John Burger, David Brill, Filip Machi
main(){char q=34,n=10,*a="main(){char q=34,n=10,*a=%c%s%c;printf(a,q,a,q,n);}%c";printf(a,q,a,q,n);}
Author: Unknown
main(){char*a="main(){char*a=%c%s%c;int b='%c'; printf(a,b,a,b,b);}";int b='"';printf(a,b,a,b,b);}
Author: Dario Dariol
main(a,b){a="main(a,b){a=%c%s%c;b='%c'; printf(a,b,a,b,b);}";b='"';printf(a,b,a,b,b);}
Author: Dario Dariol
main(a){printf(a="main(a){printf(a=%c%s%c,34,a,34);}",34,a,34);}
Author: Unknown
char *p="char *p=%c%s%c;main(){printf(p,34,p,34);}"; main(){printf(p,34,p,34);}
Author: Dario Dariol
main(a){a="main(a){a=%c%s%c;printf(a,34,a,34);}";printf(a,34,a,34);}
Author: Unknown
char f[] = "char f[] =%c%c%s%c;%cmain() {printf(f,10,34,f,34,10,10);}%c";
main() {printf(f,10,34,f,34,10,10);}
Author: Thad Smith
Notes: The author claims that this one is strict ANSI.
#include
main(){char*c="\\\"#include%cmain(){char*c=%c%c%c%.102s%cn%c
;printf(c+2,c[102],c[1],*c,*c,c,*c,c[1]);exit(0);}\n";printf(c+2,c[10
2],c[1],*c,*c,c,*c,c[1]);exit(0);}
Author: Torben Mogensen
char *a="\\\"char *a=%c%.1s%.1s%.71s%.1sn%c;main() {printf(a+2,a[1],a,a,a,a,a[1]);}\n"; main(){printf(a+2,a[1],a,a,a,a,a[1]);}
Author: Joe Miller
#define T(a) main(){printf(a,#a);}
T("#define T(a) main(){printf(a,#a);}\nT(%s)")
Author: Erkki Ruohtula (eru@tnso04.tele.nokia.fi)
#define n(v,w) v(#w"\nn("#v","#w")");}
n(main(){puts,#define n(v,w) v(#w"\nn("#v","#w")");})
Author: Paul Hsieh
#define X(Y) main(){printf("#define X(Y) %s\nX(%s)\n",#Y,#Y);}
X(main(){printf("#define X(Y) %s\nX(%s)\n",#Y,#Y);}) |
|