DIGIT-ARC read-only archive · snapshot: July 23, 2026

Can anyone figure out this C Code?

19 posts · originally from https://geek.digit.in/community/threads/can-anyone-figure-out-this-c-code.26959/

P
purifier Original post #1
Apr 14, 2006 at 10:42 PM
Does anybody have any idea how this works???

#include<stdio.h>
main()
{
int a,b,c;
int count = 1;
for (b=c=10;a=
"- LLLLLL?, LMKC,XYZHELLO FOLKS,\
TFy!QJu ROo TNn(ROo)SLq SLq ULo+\
UHs UJq TNn*RPn/QPbEWS_JSWQAIJO^\
NBELPeHBFHT}TnALVlBLOFAkHFOuFETp\
HCStHAUFAgcEAelclcn^r^r\\tZvYxXy\
T|S~Pn SPm SOn TNn ULo0ULo#ULo-W\
Hq!WFs XDt!" [b+++21]; )

for(; a-- > 64 ; )
putchar ( ++c=='Z' ? c = c/ 9:33^b&1);

}

It somehow manages to print map of India

i feel a prog has be used to generate this code ...can nybody tell does such program exists for converting a simple logic into a cryptic form
QwertyManiac
Apr 14, 2006 at 10:59 PM
I saw this here I guess... Pointers I think...
P
Apr 14, 2006 at 11:01 PM
Oh...yeah after posting...i'm searching too.. but not able to see a complete valid explanation anywhere...well pointers could be the thing...but i wonder how everything works out...
nikhil ramteke
Jan 3, 2007 at 5:28 PM
u may get answer 4m www.programmersheaven.com .....i dnt know certainly u wil b getting it or not but try.....i wil also look 4 it.....
tuxfan
tuxfan #5
Jan 3, 2007 at 6:22 PM
QwertyManiac said:
I saw this here I guess... Pointers I think...

This is not pointers.

But a is declared as an int. So it can store 2 bytes of data. Instead of that, it is stuffed with so many characters.

Additionally, the second part in the for() loop is the condition. So there should "a==..." instead of that there is a single =. So it is an assignement and not a condition.

b and c are declared immediately after a. So most likely they will occupy next 4 bytes after a. But a is stuffed with these characters. First 2 characters are accessible with a, next two with b and next 2 with c. Even count will have characters from the same string.

This is cryptic programming. My (rusted) knowledge of C isn't so good that I would understand this. But these are just a few observations. I have heard that there used to be competitions held for cryptic C programming. C is endless. :)
jal_desai
Jan 3, 2007 at 9:40 PM
ya such programs can create graphical outputs... but i think u may need to include graphics.h header file
sachin_kothari
Oct 26, 2007 at 10:54 AM
purifier said:
#include<stdio.h>
main()
{
int a,b,c;
int count = 1;
for (b=c=10;a=
"- LLLLLL?, LMKC,XYZHELLO FOLKS,\
TFy!QJu ROo TNn(ROo)SLq SLq ULo+\
UHs UJq TNn*RPn/QPbEWS_JSWQAIJO^\
NBELPeHBFHT}TnALVlBLOFAkHFOuFETp\
HCStHAUFAgcEAelclcn^r^r\\tZvYxXy\
T|S~Pn SPm SOn TNn ULo0ULo#ULo-W\
Hq!WFs XDt!" [b+++21]; )

for(; a-- > 64 ; )
putchar ( ++c=='Z' ? c = c/ 9:33^b&1);

}

It somehow manages to print map of India
This code is an obfuscated code.
They are generally unreadable but executable.
Wiki details out Obfuscated Code.
There are software available that can obfuscate any c code. Just google it and you will find lots of obfuscator tools for C, Java, etc.
saurabh kakkar
Oct 26, 2007 at 11:49 AM
sachin_kothari said:
This code is an obfuscated code.
They are generally unreadable but executable.
Wiki details out Obfuscated Code.
There are software available that can obfuscate any c code. Just google it and you will find lots of obfuscator tools for C, Java, etc.

Thanks for the info :) .I had never come through such a program :D
A
adi007 #9
Oct 26, 2007 at 12:31 PM
me too :D:D
aditya.shevade
Oct 26, 2007 at 12:55 PM
Search for obfuscated c code in google. Even looking at the winning programs gives you a headache.
fun2sh
fun2sh #11
Oct 27, 2007 at 2:02 AM
how do get such ideas :shock: :shock: :shock: :shock: :shock: :shock:

cant any1 explain that india map program. also first for[\B] loop in that prog contains only two expression instead of for(exp1;exp2;exp3)
QwertyManiac
Oct 27, 2007 at 7:39 AM
^^
For can be used without initialization and counter expressions :?

for( ; condition ; ) is valid as you can place the initialization outside and counter inside the loop if you have to. Removing the condition makes it infinite loop until break.
sachin_kothari
Oct 27, 2007 at 9:49 AM
@fun2sh
The code is obfuscated so that it remains unexplainable.
Its like you can look at the code, but cant make out the flow of the code.
fun2sh
fun2sh #14
Oct 27, 2007 at 4:40 PM
yeah i know that.we can even use like for(;;) but first for[\B] loop contains only one ;[\b] there.
deepak.krishnan
Oct 27, 2007 at 5:20 PM
OMG how can one think of such a code??? :))
ayush_chh
ayush_chh #16
Oct 27, 2007 at 7:24 PM
sachin_kothari said:
This code is an obfuscated code.
They are generally unreadable but executable.
Wiki details out Obfuscated Code.
There are software available that can obfuscate any c code. Just google it and you will find lots of obfuscator tools for C, Java, etc.

man u did a great job...never knew this........:):)

@purifirer

where did u get tis from man????
sachin_kothari
Oct 27, 2007 at 8:47 PM
^^ Check this link for more obfuscated codes.
This link is of International Obfuscated C code contest.
Enjoy :)

deepak.krishnan said:
OMG how can one think of such a code??? :))
You cannot write such codes directly.
There are obfuscated code generators which take your normal programs as input and produce obfuscated code.
Pathik
Pathik #18
Oct 27, 2007 at 8:56 PM
Yup... and i think coes are also obfuscated to make it difficult to reverse engineer it..
sachin_kothari
Oct 27, 2007 at 9:02 PM
These codes can be reversed engineered only if the technique used by the obfuscator is known.

There are some well know obfuscation techniques like
> Layout obfuscations - modify the layout structure of the program by two basic methods: renaming identifiers and removing debugging information. They make the program code less informative to a reverse engineer. Most layout obfuscations cannot be undone because they use one-way functions such as changing identifiers by random symbols and removing comments, unused methods, and debugging information. Though layout obfuscations cannot prevent reverse engineers to understand the program by observing the obfuscated code, they at least consume the cost of reverse engineering. Layout obfuscations are the most well studied and widely used in code obfuscation. Almost all Java obfuscators contain this technique.

|> Control obfuscations - change the control flow of the program. The trick is simple: For a routine A() obfuscator creates an additional routine A_bug and an "if" selector, if (PREDICATE) then A_bug(); else A();. The PREDICATE is designed on-the-fly in that way so it is always false (but it's made so it's hard to conclude that fact), and the A() routine is always selected instead of a buggy copy A_bug().

|> Data obfuscations - break the data structures used in the program and encrypt literals. This method includes modifying inheritance relations, restructuring arrays, etc. Data obfuscations thoroughly change the data structure of a program. They make the obfuscated codes so complicated that it is impossible to recreate the original source code.

Source