Here are some nice little C one liners. Most of them are from the IOCCC page. A few may not be, but I have not looked too close. I hope to have more very soon.


  1. main(){printf(&unix["\021%six\012\0"],(unix)["have"]+"fun"-0x60);}
  2. char*m="char*m=%c%s%c;main(){printf(m,34,m,34);}";main(){printf(m,34,m,34);}
  3. main(a,b){while((a=getchar())+1)putchar((b=64^a&223)&&b<27?a&96|(b+12)%26+1:a);}
  4. int i;main(){for(;i["] < i;++i){--i;}"];read('-'-'-',i+++"hello, world!\n",'/'/'/'));}read(j,i,p){write(j/p+p,i---j,i/i);}
  5. main(v,c)char**c;{for(v[c++]="Hello, world!\n)";(!!c)[*c]&&(v--||--c&&execlp(*c,*c,c[!!c]+!!c,!c));**c=!c)write(!!*c,*c,!!**c);}
  6. main(Q,O)char**O;{if(--Q){main(Q,O);O[Q][0]^=0X80;for(O[0][0]=0;O[++O[0][0]]!=0;)if(O[O[0][0]][0]>0)puts(O[O[0][0]]);puts("----------");main(Q,O);}}

back home....

This page was last modified on : 24th June '99