sourabhj 0 Report post Posted June 5, 2007 Its a code iam sharing i found while reading about c, its a code from a winner of world most obsfucated code contest just have a look the output of the program is after the code #include <stdio.h>main(t,_,a)char *a;{return!0<t?t<3?main(-79,-13,a+main(-87,1-_,main(-86, 0, a+1 )+a)):1,t<_?main(t+1, _, a ):3,main ( -94, -27+t, a)&&t == 2 ?_<13 ?main ( 2, _+1, "%s %d %d\n" ):9:16:t<0?t<-72?main(_,t,"@n'+,#'/*{}w+/w#cdnr/+,{}r/*de}+,/*{*+,/w{%+,/w#q#n+,/#{l,+,/n{n+\,/+#n+,/#;#q#n+,/+k#;*+,/'r :'d*'3,}{w+K w'K:'+}e#';dq#'l q#'+d'K#!/\+k#;q#'r}eKK#}w'r}eKK{nl]'/#;#q#n'){)#}w'){){nl]'/+#n';d}rw' i;# ){n\l]!/n{n#'; r{#w'r nc{nl]'/#{l,+'K {rw' iK{;[{nl]'/w#q#\n'wk nw' iwk{KK{nl]!/w{%'l##w#' i; :{nl]'/*{q#'ld;r'}{nlwb!/*de}'c \;;{nl'-{}rw]'/+,}##'*}#nc,',#nw]'/+kd'+e}+;\#'rdq#w! nr'/ ') }+}{rl#'{n' ')# }'+}##(!!/"):t<-50?_==*a ?putchar(a[31]):main(-65,_,a+1):main((*a == '/')+t,_,a\+1 ):0<t?main ( 2, 2 , "%s"):*a=='/'||main(0,main(-61,*a, "!ek;dc \i@bK'(q)-[w]*%n+r3#l,{}:\nuwloca-O;m .vpbks,fxntdCeghiry"),a+1);} Output of the program***************************************************************************** Output Start Here*********************************************************************************On the first day of Christmas my true love gave to mea partridge in a pear tree.On the second day of Christmas my true love gave to metwo turtle dovesand a partridge in a pear tree.On the third day of Christmas my true love gave to methree french hens, two turtle dovesand a partridge in a pear tree.On the fourth day of Christmas my true love gave to mefour calling birds, three french hens, two turtle dovesand a partridge in a pear tree.On the fifth day of Christmas my true love gave to mefive gold rings;four calling birds, three french hens, two turtle dovesand a partridge in a pear tree.On the sixth day of Christmas my true love gave to mesix geese a-laying, five gold rings;four calling birds, three french hens, two turtle dovesand a partridge in a pear tree.On the seventh day of Christmas my true love gave to meseven swans a-swimming,six geese a-laying, five gold rings;four calling birds, three french hens, two turtle dovesand a partridge in a pear tree.On the eighth day of Christmas my true love gave to meeight maids a-milking, seven swans a-swimming,six geese a-laying, five gold rings;four calling birds, three french hens, two turtle dovesand a partridge in a pear tree.On the ninth day of Christmas my true love gave to menine ladies dancing, eight maids a-milking, seven swans a-swimming,six geese a-laying, five gold rings;four calling birds, three french hens, two turtle dovesand a partridge in a pear tree.On the tenth day of Christmas my true love gave to meten lords a-leaping,nine ladies dancing, eight maids a-milking, seven swans a-swimming,six geese a-laying, five gold rings;four calling birds, three french hens, two turtle dovesand a partridge in a pear tree.On the eleventh day of Christmas my true love gave to meeleven pipers piping, ten lords a-leaping,nine ladies dancing, eight maids a-milking, seven swans a-swimming,six geese a-laying, five gold rings;four calling birds, three french hens, two turtle dovesand a partridge in a pear tree.On the twelfth day of Christmas my true love gave to metwelve drummers drumming, eleven pipers piping, ten lords a-leaping,nine ladies dancing, eight maids a-milking, seven swans a-swimming,six geese a-laying, five gold rings;four calling birds, three french hens, two turtle dovesand a partridge in a pear tree.**************************************************************************** Output ends****************************************************************************Its a cool program what if this technique can be used to compress file make a program to create a c code for a file to be compressed it will then be compiled to exe when run produces the large file Share this post Link to post Share on other sites
nirmal_1288 0 Report post Posted June 7, 2007 (edited) try this.... u will be astonished! #include <stdio.h>main(){ int c; /* Character read from the file. */ FILE *ptr; /* Pointer to the file. FILE is a structure defined in <stdio.h> */ /* Open the file - no error checking done */ ptr = fopen("/etc/hosts","r"); /* Read one character at a time, checking for the End of File. EOF is defined in <stdio.h> as -1 */ while ((c = fgetc(ptr)) != EOF) { printf("%c",c); /* O/P the character to the screen */ } fclose(ptr); /* Close the file. */ Edited June 8, 2007 by nirmal_1288 (see edit history) Share this post Link to post Share on other sites
rize619 0 Report post Posted June 24, 2007 ah crazy i can only understand the header and plus sign...hehe Share this post Link to post Share on other sites
vipervoid 0 Report post Posted September 4, 2007 wow! that code from a winner of world most obsfucated code contest was very great! I dont know how will i say it but if you'll ask me to rate it... hmmm 10/10! That's really amazing! wish i could make something like that someday! hehe! Share this post Link to post Share on other sites
faund 0 Report post Posted September 11, 2007 really a crazy code. I don't know who can understand it! Share this post Link to post Share on other sites
zamaliphe 0 Report post Posted November 17, 2007 will i have seen allot of string cod but this is very hard fo me to read i didnot think that you can actly rot sutch code in ci thout only bash of perel scrips can be like thati know that you can make sutch cod in bash but doing it in c no wayi cant even count how meny if then else in that codebut i know that he use it like thisA?B:Cif (A) then (:rolleyes:else ©and so on Share this post Link to post Share on other sites
techclave 0 Report post Posted November 30, 2007 that code is quite confusing... in fact totally confusing! is there any software which convert ordinary program into such codes? Share this post Link to post Share on other sites
rayzoredge 2 Report post Posted November 30, 2007 Wow. I can't even read that.I see the return function, but does it just call for the strings from the header file or does it actually loop, repeating the first verse and inserting variables and the second verse appropriate verse? I see conditionals, but I don't see an actual loop... it's pretty confusing.My C skills are beyond elementary... so maybe I'm just missing something here. Share this post Link to post Share on other sites
omarsdali 0 Report post Posted December 1, 2007 Its a code iam sharing i found while reading about c, its a code from a winner of world most obsfucated code contest just have a look the output of the program is after the codeCODE#include <stdio.h>main(t,_,a)char *a;{return!0<t?t<3?main(-79,-13,a+main(-87,1-_,main(-86, 0, a+1 )+a)):1,t<_?main(t+1, _, a ):3,main ( -94, -27+t, a)&&t == 2 ?_<13 ?main ( 2, _+1, "%s %d %d\n" ):9:16:t<0?t<-72?main(_,t,"@n'+,#'/*{}w+/w#cdnr/+,{}r/*de}+,/*{*+,/w{%+,/w#q#n+,/#{l,+,/n{n+\,/+#n+,/#;#q#n+,/+k#;*+,/'r :'d*'3,}{w+K w'K:'+}e#';dq#'l q#'+d'K#!/\+k#;q#'r}eKK#}w'r}eKK{nl]'/#;#q#n'){)#}w'){){nl]'/+#n';d}rw' i;# ){n\l]!/n{n#'; r{#w'r nc{nl]'/#{l,+'K {rw' iK{;[{nl]'/w#q#\n'wk nw' iwk{KK{nl]!/w{%'l##w#' i; :{nl]'/*{q#'ld;r'}{nlwb!/*de}'c \;;{nl'-{}rw]'/+,}##'*}#nc,',#nw]'/+kd'+e}+;\#'rdq#w! nr'/ ') }+}{rl#'{n' ')# }'+}##(!!/"):t<-50?_==*a ?putchar(a[31]):main(-65,_,a+1):main((*a == '/')+t,_,a\+1 ):0<t?main ( 2, 2 , "%s"):*a=='/'||main(0,main(-61,*a, "!ek;dc \i@bK'(q)-[w]*%n+r3#l,{}:\nuwloca-O;m .vpbks,fxntdCeghiry"),a+1);}Output of the programCODE***************************************************************************** Output Start Here*********************************************************************************On the first day of Christmas my true love gave to mea partridge in a pear tree.On the second day of Christmas my true love gave to metwo turtle dovesand a partridge in a pear tree.On the third day of Christmas my true love gave to methree french hens, two turtle dovesand a partridge in a pear tree.On the fourth day of Christmas my true love gave to mefour calling birds, three french hens, two turtle dovesand a partridge in a pear tree.On the fifth day of Christmas my true love gave to mefive gold rings;four calling birds, three french hens, two turtle dovesand a partridge in a pear tree.On the sixth day of Christmas my true love gave to mesix geese a-laying, five gold rings;four calling birds, three french hens, two turtle dovesand a partridge in a pear tree.On the seventh day of Christmas my true love gave to meseven swans a-swimming,six geese a-laying, five gold rings;four calling birds, three french hens, two turtle dovesand a partridge in a pear tree.On the eighth day of Christmas my true love gave to meeight maids a-milking, seven swans a-swimming,six geese a-laying, five gold rings;four calling birds, three french hens, two turtle dovesand a partridge in a pear tree.On the ninth day of Christmas my true love gave to menine ladies dancing, eight maids a-milking, seven swans a-swimming,six geese a-laying, five gold rings;four calling birds, three french hens, two turtle dovesand a partridge in a pear tree.On the tenth day of Christmas my true love gave to meten lords a-leaping,nine ladies dancing, eight maids a-milking, seven swans a-swimming,six geese a-laying, five gold rings;four calling birds, three french hens, two turtle dovesand a partridge in a pear tree.On the eleventh day of Christmas my true love gave to meeleven pipers piping, ten lords a-leaping,nine ladies dancing, eight maids a-milking, seven swans a-swimming,six geese a-laying, five gold rings;four calling birds, three french hens, two turtle dovesand a partridge in a pear tree.On the twelfth day of Christmas my true love gave to metwelve drummers drumming, eleven pipers piping, ten lords a-leaping,nine ladies dancing, eight maids a-milking, seven swans a-swimming,six geese a-laying, five gold rings;four calling birds, three french hens, two turtle dovesand a partridge in a pear tree.**************************************************************************** Output ends****************************************************************************Its a cool program what if this technique can be used to compress file make a program to create a c code for a file to be compressed it will then be compiled to exe when run produces the large file Did anyone try to compile this ? because it doesnt compile for me. besides it has some syntax errors like where is the '{' after the main fuction. Share this post Link to post Share on other sites
Csshih 0 Report post Posted December 1, 2007 I tried to read it, and I failed.Tried to compiled it, and I failedThis is what I got.Does anyone have an Idea on how to compile this?source.cpp(3) : error C2065: 't' : undeclared identifiersource.cpp(3) : error C2065: '_' : undeclared identifiersource.cpp(3) : error C2065: 'a' : undeclared identifiersource.cpp(4) : error C2448: 'main' : function-style initializer appears to be a function definitionalot of bad spacing in the program, should be a line after each ";" Share this post Link to post Share on other sites
de4thpr00f 0 Report post Posted December 1, 2007 OMG. Who's this guy? The owner of C or something? I need to try this code. If you are getting errors, maybe your source of the article made some mistakes And that code is harder to read than assembly =/Did you try to search google this?Greetz~Jo?o Lopes Share this post Link to post Share on other sites
omarsdali 0 Report post Posted December 1, 2007 I tried to read it, and I failed.Tried to compiled it, and I failedThis is what I got.Does anyone have an Idea on how to compile this?source.cpp(3) : error C2065: 't' : undeclared identifiersource.cpp(3) : error C2065: '_' : undeclared identifiersource.cpp(3) : error C2065: 'a' : undeclared identifiersource.cpp(4) : error C2448: 'main' : function-style initializer appears to be a function definitionalot of bad spacing in the program, should be a line after each ";" if you put a var type in front of t and _ and a so that it looks like this for example main(char t,char _,char a) then you will get the syntax error complaining about the missing '{' along with some other errorsIn my opinion this program doesn't work, it was either never ment to work or is missing some chunk of it. i dunno Share this post Link to post Share on other sites
mathmate 0 Report post Posted December 2, 2007 Did anyone try to compile this ? because it doesnt compile for me. besides it has some syntax errors like where is the '{' after the main fuction.I just did, using Borland C++ and command-line compiler, without changing a iota in the source code (cut and paste).There were a few warnings like:Warning C:\tmp\obfusca.c 6: Call to function 'main' with no prototype in function mainWarning C:\tmp\obfusca.c 6: Call to function 'main' with no prototype in function mainWarning C:\tmp\obfusca.c 6: Call to function 'main' with no prototype in function mainWarning C:\tmp\obfusca.c 6: Call to function 'main' with no prototype in function mainWarning C:\tmp\obfusca.c 7: Call to function 'main' with no prototype in function mainWarning C:\tmp\obfusca.c 7: Call to function 'main' with no prototype in function mainWarning C:\tmp\obfusca.c 14: Call to function 'main' with no prototype in function mainWarning C:\tmp\obfusca.c 15: Call to function 'main' with no prototype in function mainWarning C:\tmp\obfusca.c 16: Call to function 'main' with no prototype in function mainWarning C:\tmp\obfusca.c 16: Call to function 'main' with no prototype in function mainWarning C:\tmp\obfusca.c 17: Call to function 'main' with no prototype in function mainWarning C:\tmp\obfusca.c 17: Call to function 'main' with no prototype in function mainTurbo Link Version 1.50 for Win32 Copyright © 1993,1994 Borland Internationaland executable code produced exactly the output as claimed!Truly amazing and mind-boggling. Share this post Link to post Share on other sites
Csshih 0 Report post Posted December 3, 2007 Ah. I see.different compilers :)Thanks, mathmate.I'm going to try this at home, will confirm later. Share this post Link to post Share on other sites