The following six program snippets mainly accomplish these tasks:
Article from my blog: http://luzj.me/
1. Output Hello, World
2. Chaotic C language source code
All the following programs can be compiled in GCC. Only the last C ++ compiler g ++ can be used.
Programming passed.
Hello1.c
# Define _________}
# Define ________ putchar
# Define _______ main
# Define _ (a) ________ ();
# Define _____________(){
# Define _ ______ _ (0x48) _ (0x65) _ (0x6C) _ (0x6C)
# Define ___ _ (0x6F) _ (0x2C) _ (0x20) _ (0x77) _ (0x6F)
# Define ____ _ (0x72) _ (0x6C) _ (0x64) _ (0x21)
# Define _______________________
# Include <stdio. h>
_____
Hello2.c
# Include <stdio. h>
Main (){
Int x = 0, y [14], * z = & y; * (z ++) = 0x48; * (z ++) = y [x ++] + 0x1D;
* (Z ++) = y [x ++] + 0x07; * (z ++) = y [x ++] + 0x00; * (z ++) = y [x ++] + 0x03;
* (Z ++) = y [x ++]-0x43; * (z ++) = y [x ++]-0x0C; * (z ++) = y [x ++] + 0x57;
* (Z ++) = y [x ++]-0x08; * (z ++) = y [x ++] + 0x03; * (z ++) = y [x ++]-0x06;
* (Z ++) = y [x ++]-0x08; * (z ++) = y [x ++]-0x43; * (z ++) = y [x]-0x21;
X = * (-- z); while (y [x]! = NULL) putchar (y [x ++]);
}
Hello3.c
# Include <stdio. h>
# Define _ (a) goto;
# Define ___ (a) putchar ();
# Define _ (a, B) ___ (a) _ (B );
Main ()
{_ :__ (T) a: _ ('R', g) B: _ ('$', p)
C: _ ('l', f) d: _ (', s) e: _ ('A', s)
F: _ ('O', q) g: _ ('l', h) h: _ ('D', n)
I: _ ('E', w) j: _ ('E', x) k: _ ('\ n', z)
L: _ ('h', l) m: _ ('x', I) n :_('! ', K)
O: _ ('Z', q) p: _ ('Q', B) q: _ (',', d)
R: _ ('I', l) s: _ ('w', v) t: _ ('h', j)
U: _ ('A', a) v: _ ('O', a) w: _ (')', k)
X: _ ('l', c) y: _ ('\ t', g) z: ___ (0x0 )}
Hello4.c
Int n [] = {0x48,
0x65, 0x6C, 0x6C,
0x6F, 0x2C, 0x20,
0x77, 0x6F, 0x72,
0x6C, 0x64, 0x21,
0x0A, 0x00}, * m = n;
Main (n) {putchar
(* M )! = '\ 0 '? Main
(M ++): exit (n ++ );}
Hello5.c
Main () {int I, n [] = {(1 <1) <(1 <1) <1) <(1 <
1) <(1 <(1> 1) + (1 <1) <(1 <1), (1)
<1) <(1 <1) <(1 <1) <1) <(1 <1)-(1 <1) <(
1 <1) <(1 <1) + (1 <1) <(1 <1> 1) + (1)
<(1> 1), (1 <1) <(1 <1) <1) <1 <1) <(1)
<1)-(1 <1) <(1 <1) <1) <(1 <(1> 1)-(1
<1) <(1 <(1> 1), (1 <1) <(1 <1) <1 <1) <(1)
<1) <(1 <1)-(1 <1) <(1 <1) <1) <(1> 1
)-(1 <1) <(1 <(1> 1), (1 <1) <(1)
<1) <(1 <1) <(1 <1)-(1 <1) <(1 <1) <1) <(
1 <(1> 1)-(1 <(1> 1), (1 <1) <(1 <1) <1 <1
) <(1 <1) + (1 <1) <(1 <1 <1) <1) <(1 <(1> 1 )))
-(1 <1) <(1 <(1> 1), (1 <1) <1 <1 <1)
<(1 <1), (1 <1) <(1 <1 <1) <1) <(1 <1) <(1 <) <
1)-(1 <1) <(1 <1)-(1 <(1> 1), (1 <
1) <(1 <1) <(1 <1) <1) <(1 <1)-(1 <1) <(1)
<1) <(1 <(1> 1)-(1 <(1> 1), (1 <1)
) <(1 <1) <(1 <1) <(1) <(1 <1)-(1 <1) <(1)
<1) <(1 <(1> 1) + (1 <1), (1 <1) <(
1 <1) <(1 <1) <(1) <(1 <1)-(1 <1) <(1 <1)
<(1 <(1> 1)-(1 <1) <(1 <> 1 )))),
(1 <1) <(1 <1) <1) <(1 <1) <(1 <1)-(1
<1) <(1 <1) <(1 <1) + (1 <1) <(1 <1>
1), (1 <1) <(1 <1) <1) <(1 <1) + (1 <(1)
> 1), (1 <1) <(1 <1) + (1 <1) <(1 <) <(1 <(
1> 1) + (1 <(1> 1)}; for (I = (1> 1); I
<(1 <1) <(1 <1) + (1 <1) <(1 <1> 1
) + (1 <1); I ++) printf ("% c", n);}
Hello6.cpp
The following program can only be compiled by the C ++ Compiler (for example, g ++)
# Include <stdio. h>
# Define _ (_) putchar (_);
Int main (void) {int I = 0 ;_(
++
++
++
++
++
++ I) _ (++
++
++ I) _ (++
I) _ (-- ++ I )_(------
----------------------------
----------------------------
----------------------------
----------------------------
---------------- I )_(--------
---------------- I) _ (++
++
++
++
++
++
++ I)
_ (---------------- I) _ (++
I) _ (------------ I )_(--------
-------- I )_(----------------
----------------------------
----------------------------
----------------------------
----------------------------
------ I )_(------------------
----------------------------
I) return I ;}