Thompson's self-duplicating program

BALDWIN mike at whuxl.UUCP
Wed Aug 22 02:24:57 AEST 1984


[In reference to Thompson's paper in the last ACM Computer Magazine]
The shortest self-duplicating C program I've seen is:

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

It doesn't have a newline at the end.  It's a slight
variation of something I saw a while ago somewhere...

							Michael Baldwin
							harpo!whuxl!mike



More information about the Comp.lang.c mailing list