Anonymous.c
Source:
int i;main(){for(;i["]<i;++i){--i;}"];read(‘-‘-‘-‘,i+++"hell\o, world!\n",‘/‘/‘/‘));}read(j,i,p){write(j/p+p,i---j,i/i);}
This code looks very dizzying, we use the editor to format it after the code is as follows:
int i;main(){ for(; i["]<i;++i){--i;}"]; read(‘-‘-‘-‘,i+++"hello, world!\n",‘/‘/‘/‘));}read(j,i,p){ write(j/p+p,i---j,i/i);}
Believe the formatted code for a C novice, looking still very faint, we continue to look down. 1.1 Point Interpretation
This code has only one for loop and no loop body.
The For loop is divided into 3 parts (by ";" Separated
The first part is assigning a variable to a value
The second part is the conditional judgment Statement of the loop body, when the value of the judgment statement is greater than 0 or a non-null value when the loop body is executed and then the variable is added 1, then the judgment statement .... Exits when the judgment statement is a 0 or null value.
The third part is to increase the variable by 1 or minus 1 (increase n, minus N)
We represent strings and expressions in code in # define for ease of analysis.
#define A '-'-'-' //Don't think this is a string, then you're wrong. This is an expression, character-minus character-and the result is 0. You don't see it? Learn the operator precedence rules. #define B '/'/'/'//' also , this should not be considered a string, this is a division operation, the result is 1. #define C "hell\ //This is the real string. Some people will ask why not write "hello,world\n" directly, but written "Hell\ O, world!\n"//o, world!\n", Notice \o Middle is carriage return to line, why write so, in order to let you faint. This is an escape character, displayed or the English letter O, if the line does not wrap the compiler will prompt a warning, after the line is not prompted.#define D "]<i;++i) {-I.}" //The author wrote this string purely to fool you, and I was fooled when I first saw it. It's also a string in the For loop. So don't be deceived by your eyes. String length is 14, why do you want to describe the length of the string? Hello, world! string length is 13, don't forget \ n. intI;main () { for(; i[d]; Read (a,i+++c,b));//The length of the D string here is 14, so loop 14 times. }read (j,i,p) {write (J/p+p,i---j,i/i);}
This read function still looks faint in the for loop, let's parse it.
read(A,i+++C,B) //前面咱们已经说过了,A=0,B=1,替换后的函数为 read(0,i+++C,1)将参数替换后的read(0,i,1) //参数i 和main上面定义的i(for循环体中的)可不是同一个变量,不要搞混。i的值为 i+++"hell\o, world!\n",这个表达式中的i是for循环中的i变量。{ write(0/1+1,i---0,i/i); //也可以写成 write(1,i---0,1); //将参数i替换后 write(1,i+++"hell\o, world!\n"---0,1)此时的i是for循环中的i //i+++"hell\o, world!\n"---0,这个字符串是根据变量i取字符串长度的,比如i变量现在是7,那么字符串的结果是world!\n。 其实字符串的地址加上变量i的结果,然后再将变量i增1。后面的---0也是障眼法。}
Completely replaced for
for(;i["]<i;++i){--i;}"];write(1,i+++"hell\o, world!\n"---0,1))
Look at the dizzy no, haha.
i["]<i;++i){--i;}"]
This string can also be written so that "]<i;++i){--i;}"[i]
the result of the operation is the same. Each character in a string is a non-0 value or a null,for conditional judgment statement executes 14 times, oh, yes.
For loop self-increment i in the Write function, find it come on, pro.
The whole program runs pretty much as well. Do you get it?
Younger brother is also just learning C plus primary language did not graduate, there is no clear interpretation of the place please the great God to spit noisy!
International C Language Chaos Code contest all the winning source 1984----Research and analysis