L
lnzju
main(_){for(--_;putchar(_++["J!Mpwf!Zpv\1"]-1);}
lnzju said:main(_){for(--_;putchar(_++["J!Mpwf!Zpv\1"]-1);}
lnzju said:main(_){for(--_;putchar(_++["J!Mpwf!Zpv\1"]-1);}
Ivan said:lnzju said:main(_){for(--_;putchar(_++["J!Mpwf!Zpv\1"]-1);}
Don't. It's rubbish.
Broeisi said:Ivan said:Don't. It's rubbish.lnzju said:main(_){for(--_;putchar(_++["J!Mpwf!Zpv\1"]-1);}
Well it ain't rubbish cause it is valid C!!
Try compiling it..
The output will be:
I Love You
But this code is obfuscated.... Only the real C gurus will understand it
I Guess.... not this novice guy...
Broeisi said:Ivan said:lnzju said:main(_){for(--_;putchar(_++["J!Mpwf!Zpv\1"]-1);}
Don't. It's rubbish.
Well it ain't rubbish cause it is valid C!!
Try compiling it..
The output will be:
I Love You
But this code is obfuscated.... Only the real C gurus will understand it
I Guess.... not this novice guy...
lnzju said:main(_){for(--_;putchar(_++["J!Mpwf!Zpv\1"]-1);}
lnzju said:main(_){for(--_;putchar(_++["J!Mpwf!Zpv\1"]-1);}
lnzju said:main(_){for(--_;putchar(_++["J!Mpwf!Zpv\1"]-1);}
pemo said:lnzju said:main(_){for(--_;putchar(_++["J!Mpwf!Zpv\1"]-1);}
Ah, but run it with some params, and it's dissapointing. Perhaps the
initialiser in the for loop would have been better this way?
for(_^=_; putchar(_++["J!Mpwf!Zpv\1"]-1); );
(in article said:Ivan said:lnzju said:main(_){for(--_;putchar(_++["J!Mpwf!Zpv\1"]-1);}
Don't. It's rubbish.
Well it ain't rubbish cause it is valid C!!
Try compiling it..
The output will be:
I Love You
But this code is obfuscated.... Only the real C gurus will understand it
I Guess.... not this novice guy...
tmp123 said:Even when "gcc" compiled with the flags -ansi and -pedantic, it
produces no errors nor warnings. Only with -std=c99 it produces 3
warnings.
Broeisi said:Well it ain't rubbish cause it is valid C!!
Try compiling it..
Broeisi wrote
(in article said:Ivan said:main(_){for(--_;putchar(_++["J!Mpwf!Zpv\1"]-1);}
Don't. It's rubbish.
Well it ain't rubbish cause it is valid C!!
Not really no.
Try compiling it..
The output will be:
I Love You
Funny, this EBCDIC box in the corner outputs:
"Slartibartfast, system halted."
My DSK9000 outputs:
"My, what a silly little boy you are today."
Immediately afterward, it caught on fire, and now you owe me a
new one.
(in article said:Broeisi wrote
(in article said:Ivan Budiselic wrote:
main(_){for(--_;putchar(_++["J!Mpwf!Zpv\1"]-1);}
Don't. It's rubbish.
Well it ain't rubbish cause it is valid C!!
Not really no.
Try compiling it..
The output will be:
I Love You
Funny, this EBCDIC box in the corner outputs:
"Slartibartfast, system halted."
My DSK9000 outputs:
"My, what a silly little boy you are today."
Immediately afterward, it caught on fire, and now you owe me a
new one.
Other than the one-argument main(), there's no actual undefined
behavior, as far as I can tell. of course, the values of specific
characters are implementation-defined, so it's not strictly conforming -
that doesn't give the DS9K license to catch on fire, though.
BTW, where is stdio.h?
Roberto said:lnzju said:main(_){for(--_;putchar(_++["J!Mpwf!Zpv\1"]-1);}
fidlee said:Roberto said:lnzju said:main(_){for(--_;putchar(_++["J!Mpwf!Zpv\1"]-1);}
can someone please explain as to what the initialization part of the
for loop does. How does the underscore '_' play a part in the for loop?
(in the initialization and the putchar function)?
tmp123 said:fidlee said:Roberto said:main(_){for(--_;putchar(_++["J!Mpwf!Zpv\1"]-1);}
can someone please explain as to what the initialization part of the
for loop does. How does the underscore '_' play a part in the for loop?
(in the initialization and the putchar function)?
Hi,
1) "_" can be the name of a variable. In this case, it is the name of
the first parameter of the function main (usually called argc). If the
program is called without arguments, it takes value 1. (to be
practical, I will rename it to "i").
2) This variable is used as iterator of the for statement. It is
decremented at init (it takes value 0) and increment at for continue
condition (++).
3) It is used as index to char string. Taken into account that:
a <==> *(a+b)
The expression i["1234"] <=> *(i+"1234") <=> "1234" : i-th character
of the string.
Hope this answer was useful to you.
Kind regards.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.