self-reversing programs

K. A. Dahlke eklhad at ihnet.UUCP
Sat Sep 8 05:02:04 AEST 1984


<source.c ..... c.ecruos>

The following program prints itself in reverse.
It is only 202 bytes long, and i can't find any way to make it shorter.
There are (of course) no new lines in it,
but i broke it up here for the sake of the net.

char*q=
"char*q=;p(c){putchar(c);}
main(n){char*s=q+100;while(s-->q){
if(s==q+6&n)p(34),main(0),p(34); p(*s);}}";
p(c){putchar(c);}
main(n){char*s=q+100;while(s-->q){
if(s==q+6&n)p(34),main(0),p(34); p(*s);}}

Any shorter??
-- 

Karl Dahlke    ihnp4!ihnet!eklhad



More information about the Comp.lang.c mailing list