473,804 Members | 3,162 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

can u explain this code?

my friend gave this code to me..... it is working fine....how come?

please explain me if u can understand.....

#include <stdio.h>
#include <conio.h>
#define _(__,___)\
___##__
_(id,vo) _8(_(
ar,ch)a,_(ar ,ch
)*_2){_(ile,wh) (a
--)_(ntf, pri)("%s"
,_2);}_(id,vo) _1(_
(nt,i) s,_(nt,i) n,
_(nt,i) k=1,_(ar,ch
) *_3="* "){_8 ( k,
"\n");_8(s, " ");_8(
n,_3);}_(id,vo) _6(_(nt,i) k,_(nt,i)
l,_(ar,ch) *_9_){_8(k,"\n" );_8(l, " ");_(ile
,wh)(*_9_)_(ntf ,pri)("%c",*_9_ ++-12);} _(id,
vo) _(in,ma)(){_(ar ,ch) _1_1_[]="cu€" "t,nq"
"€,~qsm~p8",_2 _2_[]="X{wm";_(ar,ch ) _22[]=
{240,32,0},_4;_ 1(20,3,6);_1(19 ,1)
;_1(4,1,0);_1(1 9,1); _1(1,1, 0,
_22);_1(1,1,0); _1(19,1);
_1(4,1,0);_1(15 ,8);
_1(13,10);_1(0, 1,0,"*");_
(or,f)(_4=0;_4< 4;_4++) {_1(15+_4*2,
8-_4*2);_(f,i)(_4 ==0) _1(0,2,0," *");}_(
or,f)(_4=2;_4>= 0;_4--)_1(15+_4*2,8-_4*2);_6(3,
26,_1_1_);_6(2, 40,_2_2_);_(ile ,wh)(!_(it,kbh) ());}

Aug 8 '06 #1
11 1906
ka************* *@gmail.com said:
my friend gave this code to me..... it is working fine....how come?
foo.c:2: conio.h: No such file or directory

Looks like it doesn't work fine after all.

And even if you ignore that, it gets the entry point's return type wrong, so
the behaviour of the program is undefined. There's nothing even remotely
fine about this program.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
Aug 8 '06 #2
On Tue, 8 Aug 2006 ka************* *@gmail.com wrote:
my friend gave this code to me..... it is working fine....how come?

please explain me if u can understand.....

#include <stdio.h>
#include <conio.h>
#define _(__,___)\
___##__
_(id,vo) _8(_(
ar,ch)a,_(ar ,ch
)*_2){_(ile,wh) (a
--)_(ntf, pri)("%s"
,_2);}_(id,vo) _1(_
(nt,i) s,_(nt,i) n,
_(nt,i) k=1,_(ar,ch
) *_3="* "){_8 ( k,
"\n");_8(s, " ");_8(
n,_3);}_(id,vo) _6(_(nt,i) k,_(nt,i)
l,_(ar,ch) *_9_){_8(k,"\n" );_8(l, " ");_(ile
,wh)(*_9_)_(ntf ,pri)("%c",*_9_ ++-12);} _(id,
vo) _(in,ma)(){_(ar ,ch) _1_1_[]="cu€" "t,nq"
"€,~qsm~p8",_2 _2_[]="X{wm";_(ar,ch ) _22[]=
{240,32,0},_4;_ 1(20,3,6);_1(19 ,1)
;_1(4,1,0);_1(1 9,1); _1(1,1, 0,
_22);_1(1,1,0); _1(19,1);
_1(4,1,0);_1(15 ,8);
_1(13,10);_1(0, 1,0,"*");_
(or,f)(_4=0;_4< 4;_4++) {_1(15+_4*2,
8-_4*2);_(f,i)(_4 ==0) _1(0,2,0," *");}_(
or,f)(_4=2;_4>= 0;_4--)_1(15+_4*2,8-_4*2);_6(3,
26,_1_1_);_6(2, 40,_2_2_);_(ile ,wh)(!_(it,kbh) ());}
Nonportabilitie s [1] aside, the actual obfuscation here is
fairly simple: #define _(__,___) ___##__ concatenates its two
arguments in reverse. Thus, _(id,vo) gives gives you void,
_(ar,ch)*_2 gives you char*_2 (and so forth).

Tak-Shing

[1] I would leave it to the pedants to enumerate them.
Aug 8 '06 #3
Tak-Shing Chan (in
Pi************* *************** **...o.gold .ac.uk) said:

| On Tue, 8 Aug 2006 ka************* *@gmail.com wrote:
|
|| my friend gave this code to me..... it is working fine....how come?
||
|| please explain me if u can understand.....
||
|| #include <stdio.h>
|| #include <conio.h>
||
||
|| #define _(__,___)\
|| ___##__
|| _(id,vo) _8(_(
|| ar,ch)a,_(ar ,ch
|| )*_2){_(ile,wh) (a
|| --)_(ntf, pri)("%s"
|| ,_2);}_(id,vo) _1(_
|| (nt,i) s,_(nt,i) n,
|| _(nt,i) k=1,_(ar,ch
|| ) *_3="* "){_8 ( k,
|| "\n");_8(s, " ");_8(
|| n,_3);}_(id,vo) _6(_(nt,i) k,_(nt,i)
|| l,_(ar,ch) *_9_){_8(k,"\n" );_8(l, " ");_(ile
|| ,wh)(*_9_)_(ntf ,pri)("%c",*_9_ ++-12);} _(id,
|| vo) _(in,ma)(){_(ar ,ch) _1_1_[]="cu?" "t,nq"
|| "?,~qsm~p8",_2 _2_[]="X{wm";_(ar,ch ) _22[]=
|| {240,32,0},_4;_ 1(20,3,6);_1(19 ,1)
|| ;_1(4,1,0);_1(1 9,1); _1(1,1, 0,
|| _22);_1(1,1,0); _1(19,1);
|| _1(4,1,0);_1(15 ,8);
|| _1(13,10);_1(0, 1,0,"*");_
|| (or,f)(_4=0;_4< 4;_4++) {_1(15+_4*2,
|| 8-_4*2);_(f,i)(_4 ==0) _1(0,2,0," *");}_(
|| or,f)(_4=2;_4>= 0;_4--)_1(15+_4*2,8-_4*2);_6(3,
|| 26,_1_1_);_6(2, 40,_2_2_);_(ile ,wh)(!_(it,kbh) ());}
|
| Nonportabilitie s [1] aside, the actual obfuscation here is
| fairly simple: #define _(__,___) ___##__ concatenates its two
| arguments in reverse. Thus, _(id,vo) gives gives you void,
| _(ar,ch)*_2 gives you char*_2 (and so forth).
|
| Tak-Shing
|
| [1] I would leave it to the pedants to enumerate them.

Ugh, not pretty! With liberal renaming I got:

#include <stdio.h>
#include <conio.h>

void fna(char a,char *s)
{ while (a--) printf("%s",s);
}

void fnb(int k,int l,char *9)
{ fna(k,"\n");
fna(l, " ");
while(*9) printf("%c",*9+ +-12);
}

void fnc(int s,int n,int k=1,char *t="* ")
{ fna(k,"\n");
fna(s," ");
fna(n,t);
}

void main()
{ char v1[] = "cu?t,nq?,~qsm ~p8",
v2[] = "X{wm",
v3[] = { 240,32,0 },
i;

fnc(20,3,6);
fnc(19,1);
fnc(4,1,0);
fnc(19,1);
fnc(1,1, 0,v3);
fnc(1,1,0);
fnc(19,1);
fnc(4,1,0);
fnc(15,8);
fnc(13,10);
fnc(0,1,0,"*");
for (i=0; i<4; i++)
{ fnc(15+i*2,8-i*2);
if (i==0) fnc(0,2,0," *");
}
for (i=2; i>=0; i--) fnc(15+i*2,8-i*2);
fnb(3,26,v1);
fnb(2,40,v2);
while (!kbhit()) ;
}

Left as an exercise for the OP to enumerate the problems.

--
Morris Dovey
DeSoto Solar
DeSoto, Iowa USA
http://www.iedu.com/DeSoto
Aug 8 '06 #4
ka************* *@gmail.com writes:
my friend gave this code to me..... it is working fine....how come?

please explain me if u can understand.....
"u" doesn't read this newsgroup. If you meant "you", please say so.
Silly abbreviations like "u" for "you" are discouraged here.
#include <stdio.h>
#include <conio.h>
This is a system-specific header.
>
#define _(__,___)\
___##__
The identifiers __ and ___ are reserved to the implementation.

Leaving that aside, the macro takes two arguments and pastes them
together in reverse order. For example, "_(id,vo)" expands to "void".
_(id,vo) _8(_(
ar,ch)a,_(ar ,ch
)*_2){_(ile,wh) (a
[snip]

It's not worth my time to wade through all that noise. If you're
curious find out if your compiler has an option to show you the output
of the preprocessor. Coment out the #include directives so it doesn't
insert the contents of those headers into the output.

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Aug 8 '06 #5
Keith Thompson wrote:
ka************* *@gmail.com writes:
>#define _(__,___)\
___##__

The identifiers __ and ___ are reserved to the implementation.
Even as macro arguments? On comp.std.c I was told that

#if 0
__special
#endif
int main(void) {}

and

#ifdef __special
/* nothing */
#endif
int main(void) {}

are both strictly conforming -- essentially because __special is only
reserved for "any" use after preprocessing. During preprocessing, it is
reserved for use as a macro name, but not for anything beyond that unless
it doesn't affect any (otherwise) strictly conforming program. Since naming
your macro arguments __ and ___ prevents any predefined macros __ and ___
from being expanded, I think that should be fine.
Aug 8 '06 #6
Harald van Dijk <tr*****@gmail. comwrites:
Keith Thompson wrote:
>ka************* *@gmail.com writes:
>>#define _(__,___)\
___##__

The identifiers __ and ___ are reserved to the implementation.

Even as macro arguments? On comp.std.c I was told that

#if 0
__special
#endif
int main(void) {}

and

#ifdef __special
/* nothing */
#endif
int main(void) {}

are both strictly conforming -- essentially because __special is only
reserved for "any" use after preprocessing. During preprocessing, it is
reserved for use as a macro name, but not for anything beyond that unless
it doesn't affect any (otherwise) strictly conforming program. Since naming
your macro arguments __ and ___ prevents any predefined macros __ and ___
from being expanded, I think that should be fine.
You may be right; I'm not sure. (I avoid the issue by avoiding
identifiers starting with '_' altogether.)

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Aug 8 '06 #7
Harald van Dijk schrieb:
Keith Thompson wrote:
>>ka*********** ***@gmail.com writes:
>>>#define _(__,___)\
___##__

The identifiers __ and ___ are reserved to the implementation.

Even as macro arguments? On comp.std.c I was told that

#if 0
__special
#endif
int main(void) {}

and

#ifdef __special
/* nothing */
#endif
int main(void) {}

are both strictly conforming -- essentially because __special is only
reserved for "any" use after preprocessing. During preprocessing, it is
reserved for use as a macro name, but not for anything beyond that unless
it doesn't affect any (otherwise) strictly conforming program. Since naming
your macro arguments __ and ___ prevents any predefined macros __ and ___
from being expanded, I think that should be fine.
Predefined macro names must not be the subject of a #define or
#undef directive; i.e. #define __(_,___) ___##_ would not have
been allowed as _ followed by an uppercase letter or _ belongs to
the "implementa tion namespace" for predefined macro names. (C99,
6.10.8#4)
Identifiers starting with _ followed by an uppercase letter or
_ are always reserved for any use, identifiers starting with
_ followed by a lowercase letter are reserved for file scope
(ordinary and tag namespace) identifiers. (C99, 7.10.3#1)
As macro names are identifiers (C99, 6.2.1#1), I'd say you are
right.
Cheers
Michael
--
E-Mail: Mine is an /at/ gmx /dot/ de address.
Aug 8 '06 #8
MQ

ka************* *@gmail.com wrote:
my friend gave this code to me..... it is working fine....how come?

please explain me if u can understand.....

#include <stdio.h>
#include <conio.h>
#define _(__,___)\
___##__
_(id,vo) _8(_(
ar,ch)a,_(ar ,ch
)*_2){_(ile,wh) (a
--)_(ntf, pri)("%s"
,_2);}_(id,vo) _1(_
(nt,i) s,_(nt,i) n,
_(nt,i) k=1,_(ar,ch
) *_3="* "){_8 ( k,
"\n");_8(s, " ");_8(
n,_3);}_(id,vo) _6(_(nt,i) k,_(nt,i)
l,_(ar,ch) *_9_){_8(k,"\n" );_8(l, " ");_(ile
,wh)(*_9_)_(ntf ,pri)("%c",*_9_ ++-12);} _(id,
vo) _(in,ma)(){_(ar ,ch) _1_1_[]="cu€" "t,nq"
"€,~qsm~p8",_2 _2_[]="X{wm";_(ar,ch ) _22[]=
{240,32,0},_4;_ 1(20,3,6);_1(19 ,1)
;_1(4,1,0);_1(1 9,1); _1(1,1, 0,
_22);_1(1,1,0); _1(19,1);
_1(4,1,0);_1(15 ,8);
_1(13,10);_1(0, 1,0,"*");_
(or,f)(_4=0;_4< 4;_4++) {_1(15+_4*2,
8-_4*2);_(f,i)(_4 ==0) _1(0,2,0," *");}_(
or,f)(_4=2;_4>= 0;_4--)_1(15+_4*2,8-_4*2);_6(3,
26,_1_1_);_6(2, 40,_2_2_);_(ile ,wh)(!_(it,kbh) ());}
Yikes, someone has too much spare time....

Aug 9 '06 #9

ka************* *@gmail.com wrote:
my friend gave this code to me..... it is working fine....how come?

please explain me if u can understand.....

#include <stdio.h>
#include <conio.h>
#define _(__,___)\
___##__
_(id,vo) _8(_(
ar,ch)a,_(ar ,ch
)*_2){_(ile,wh) (a
--)_(ntf, pri)("%s"
,_2);}_(id,vo) _1(_
(nt,i) s,_(nt,i) n,
_(nt,i) k=1,_(ar,ch
) *_3="* "){_8 ( k,
"\n");_8(s, " ");_8(
n,_3);}_(id,vo) _6(_(nt,i) k,_(nt,i)
l,_(ar,ch) *_9_){_8(k,"\n" );_8(l, " ");_(ile
,wh)(*_9_)_(ntf ,pri)("%c",*_9_ ++-12);} _(id,
vo) _(in,ma)(){_(ar ,ch) _1_1_[]="cu€" "t,nq"
"€,~qsm~p8",_2 _2_[]="X{wm";_(ar,ch ) _22[]=
{240,32,0},_4;_ 1(20,3,6);_1(19 ,1)
;_1(4,1,0);_1(1 9,1); _1(1,1, 0,
_22);_1(1,1,0); _1(19,1);
_1(4,1,0);_1(15 ,8);
_1(13,10);_1(0, 1,0,"*");_
(or,f)(_4=0;_4< 4;_4++) {_1(15+_4*2,
8-_4*2);_(f,i)(_4 ==0) _1(0,2,0," *");}_(
or,f)(_4=2;_4>= 0;_4--)_1(15+_4*2,8-_4*2);_6(3,
26,_1_1_);_6(2, 40,_2_2_);_(ile ,wh)(!_(it,kbh) ());}
If u have many spare time. u can find all the code on IOCCC. This
place u can find what u want, hah

Aug 9 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

22
2118
by: Jaspreet | last post by:
I was recently asked this question in an interview. Unfortunately I was not able to answer it and the interviewer made a decision on my C strengths (or weekness) based on this single question and that was a sad end to my interview. Here is the program: #include <stdio.h> int main() { char *c ="abc";
10
2161
by: Jeff Boes | last post by:
I'm hoping there's someone here with experience in building the Visual Explain tool from Red Hat. I downloaded it and the J2 SDK, but when I attempt to follow the build instructions, I get messages like: error: Type `JTableHeader' not found in the declaration of the local variable `header'. JTableHeader header = null; To me, this indicates that the SDK isn't installed (properly). But I admit I'm pretty much a Java...
5
3639
by: Jon Lapham | last post by:
I have been using the EXPLAIN ANALYZE command to debug some performance bottlenecks in my database. In doing so, I have found an oddity (to me anyway). The "19ms" total runtime reported below actually takes 25 seconds on my computer (no other CPU intensive processes running). Is this normal for EXPLAIN ANALYZE to report a total runtime so vastly different from wall clock time? During the "explain ANALYZE delete from msgid;" the CPU is...
4
12732
by: marklawford | last post by:
Not having earned my DBA badge from the scouts just yet I'm a little lost with an error I'm getting. We've just upgraded our development database from 7.2 to 8.2 as the first step in upgrading our wider environment. Of course, development doesn't stop so I'm running some explain plans over some new views. The problem is, when the view is accessed as part of the explain plan script, the following error is returned.
0
1910
by: JAW | last post by:
This plan seems like it should perform well. Does anyone see anything. SQL Statement Text: DECLARE MTR - RDG - EST - CSR CURSOR FOR
11
1821
by: Faisal Vali | last post by:
Hi - I'm new to javascript and I was reading the book Javascript Professional Projects - there is a fragment that has me a little perplexed, and I was wondering if anyone could explain why and how it works. How is it that setting a property to null alters another property? For example setting optionObject.options = null; seems to set optionObject.selectedIndex to -1 automagically. Can you attach "hooks" in javascript that get called...
5
8118
by: kabotnet | last post by:
Hi, I'm new in db2, I'm trying to execute EXPLAIN command on some queries but i have error like: And message similar to: Token EXPLAIN is not valid, valid tokens ( END GET SET CALL DROP FREE HOLD LOCK OPEN WITH ALTER. I've created tables explain_* How can I start to find solution? Is it possible that my db2 doesn't support explain?
3
1467
by: sathishc58 | last post by:
Hi All, Here is the code which generates Segmentation Fault. Can anyone explain why the third printf fails and the first printf works? main() { char ch={"Hello"}; char *p; p=ch; printf("Character is %c\n", *p);
0
2782
by: LanaR | last post by:
Hello, one sql statement is causing severe performance issue. The problem occurs only in UDB environment, the same statemnt on the mainframe is running fine. I have an explain output from the sql. The statement itself is not that complicated, it is 3 selects and union all. Explain output is pretty big, but I could not find anything unusual. I'm new to db2 and I could be missing stuff. I am posting the explain output below and I really...
1
3583
by: w.l.fischer | last post by:
Hi, the following sequence: set current explain mode yes; set current explain snapshot yes; update ...; set current explain mode no;
0
9585
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10586
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10323
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10082
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9161
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7622
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6856
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4301
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2997
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.