Welcome to Dream.In.Code
Become a C++ Expert!

Join 149,934 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 1,510 people online right now. Registration is fast and FREE... Join Now!




How does this C code work?

 
Reply to this topicStart new topic

How does this C code work?

Rating  2
salilmulay
21 Jan, 2008 - 05:49 AM
Post #1

New D.I.C Head
*

Joined: 21 Jan, 2008
Posts: 1

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;# \
){nl]!/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(31[a]):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);}







this code was unindented ... and i cant understand how this works... just see the output and u'll be shocked!!


User is offlineProfile CardPM
+Quote Post

Trogdor
RE: How Does This C Code Work?
21 Jan, 2008 - 06:07 AM
Post #2

D.I.C Addict
Group Icon

Joined: 6 Oct, 2006
Posts: 549



Thanked: 4 times
Dream Kudos: 125
My Contributions
It works.
I am not shocked, its just obfuscated code, i have seen much nicer obfuscated code, for example a mandelbrot fractal generator in 3 lines.
User is offlineProfile CardPM
+Quote Post

Jingle
RE: How Does This C Code Work?
21 Jan, 2008 - 11:55 AM
Post #3

D.I.C Regular
***

Joined: 20 Oct, 2007
Posts: 250


My Contributions
pretty crazy


User is offlineProfile CardPM
+Quote Post

MorphiusFaydal
RE: How Does This C Code Work?
21 Jan, 2008 - 02:08 PM
Post #4

D.I.C Lover
Group Icon

Joined: 12 May, 2005
Posts: 1,213



Thanked: 15 times
Expert In: Hardware, Networking

My Contributions
http://www.ioccc.org/

International Obfusticated C Coding Competition. smile.gif
User is offlineProfile CardPM
+Quote Post

Tom9729
RE: How Does This C Code Work?
21 Jan, 2008 - 04:38 PM
Post #5

Debian guru
Group Icon

Joined: 30 Dec, 2007
Posts: 1,589



Thanked: 12 times
Dream Kudos: 325
My Contributions
http://en.wikipedia.org/wiki/Obfuscated_code
User is online!Profile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 1/8/09 03:57PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month