The following six program snippets mainly accomplish these tasks:
Output Hello, World
Chaotic C language source code
All the following programs can be compiled in GCC. Only the last C ++ compiler g ++ can be programmed.
Hello1.c
01 # define _________}
02 # define ________ putchar
03 # define _______ main
04 # define _ (a) ________ ();
05 # define _____________(){
06 # define _ ______ _ (0x48) _ (0x65) _ (0x6C) _ (0x6C)
07 # define ___ _ (0x6F) _ (0x2C) _ (0x20) _ (0x77) _ (0x6F)
08 # define ____ _ (0x72) _ (0x6C) _ (0x64) _ (0x21)
09 # define _______________________
10 # include <stdio. h>
11 _____
Hello2.c
1 # include <stdio. h>
2 main (){
3 int x = 0, y [14], * z = & y; * (z ++) = 0x48; * (z ++) = y [x ++] + 0x1D;
4 * (z ++) = y [x ++] + 0x07; * (z ++) = y [x ++] + 0x00; * (z ++) = y [x ++] + 0x03;
5 * (z ++) = y [x ++]-0x43; * (z ++) = y [x ++]-0x0C; * (z ++) = y [x ++] + 0x57;
6 * (z ++) = y [x ++]-0x08; * (z ++) = y [x ++] + 0x03; * (z ++) = y [x ++]-0x06;
7 * (z ++) = y [x ++]-0x08; * (z ++) = y [x ++]-0x43; * (z ++) = y [x]-0x21;
8 x = * (-- z); while (y [x]! = NULL) putchar (y [x ++]);
9}
Hello3.c
01 # include <stdio. h>
02 # define _ (a) goto;
03 # define ___ (a) putchar ();
04 # define _ (a, B) ___ (a) _ (B );
05 main ()
06 {_ :__ (t) a: _ ('R', g) B: _ ('$', p)
07 c: _ ('l', f) d: _ (', s) e: _ ('A', s)
08 f: _ ('O', q) g: _ ('l', h) h: _ ('D', n)
09 I: _ ('E', w) j: _ ('E', x) k: _ ('\ n', z)
10 l: _ ('h', l) m: _ ('x', I) n :_('! ', K)
11 o: _ ('Z', q) p: _ ('Q', B) q: _ (',', d)
12 r: _ ('I', l) s: _ ('w', v) t: _ ('h', j)
13 u: _ ('A', a) v: _ ('O', a) w: _ (')', k)
14 x: _ ('l', c) y: _ ('\ t', g) z: ___ (0x0 )}
Hello4.c
1 int n [] = {0x48,
2 0x65, 0x6C, 0x6C,
3 0x6F, 0x2C, 0x20,
4 0x77, 0x6F, 0x72,
5 0x6C, 0x64, 0x21,
6 0x0A, 0x00}, * m = n;
7 main (n) {putchar
8 (* m )! = '\ 0 '? Main
9 (m ++): exit (n ++ );}
Hello5.c
01 main () {int I, n [] = {(1 <1) <(1 <1) <1) <(1 <
02 1) <(1 <(1> 1) + (1 <1) <(1 <1), (1
03 <1) <(1 <1) <(1 <1) <(1 <1)-(1 <1) <(
04 1 <1) <(1 <1) + (1 <1) <(1 <1> 1) + (1)
05 <(1> 1), (1 <1) <(1 <1) <1) <1 <1 <1) <(1)
06 <1)-(1 <1) <(1 <1) <1) <(1 <(1> 1)-(1
07 <1) <(1 <(1> 1), (1 <1) <1 <1 <1) <(1
08 <1) <(1 <1)-(1 <1) <(1 <1) <(1 <(1> 1
09)-(1 <1) <(1 <(1> 1), (1 <1) <(1)
10 <1) <(1 <1) <(1) <(1 <1)-(1 <1) <(1 <1) <(
11 1 <(1> 1)-(1 <(1> 1), (1 <1) <(1 <1
12) <(1 <1) + (1 <1) <(1 <1) <(1 <(1> 1 )))
13-(1 <1) <(1 <(1> 1), (1 <1) <1 <1 <1)
14 <(1 <1), (1 <1) <1 <1) <(1 <1) <1 <1) <(1 <
15 1)-(1 <1) <(1 <1)-(1 <(1> 1 ))), (1 <
16 1) <(1 <1) <(1 <1) <1) <(1 <1 <1)-(1 <1) <(1)
17 <1) <(1 <(1> 1)-(1 <(1> 1), (1 <1 <1)
18) <(1 <1) <(1 <1) <(1) <(1 <1)-(1 <1) <(1)
19 <1) <(1 <(1> 1) + (1 <1), (1 <1) <(
20 1 <1) <(1 <1) <(1) <(1 <1)-(1 <1) <(1 <1)
21 <(1 <(1> 1)-(1 <1) <(1 <> 1 )))),
22 (1 <1) <(1 <1) <1) <(1 <1) <1 <1)-(1
23 <1) <(1 <1) <(1) <(1 <1) + (1 <1) <(1 <1>
(24 1), (1 <1) <(1 <1) <1) <(1 <1) + (1 <(1)
25> 1), (1 <1) <(1 <1) + (1 <1) <(1 <1) <(1 <(
26 1> 1) + (1 <(1> 1)}; for (I = (1> 1); I
27 <(1 <1) <(1 <1) + (1 <1) <(1 <1) <(1 <1> 1
28) + (1 <1); I ++) printf ("% c", n [I]);}
Hello6.cpp
The following program can only be compiled by the C ++ Compiler (for example, g ++)
01 # include <stdio. h>
02 # define _ (_) putchar (_);
03 int main (void) {int I = 0 ;_(
04 ++
05 ++
06 ++
07 ++
08 ++
09 ++ + I) _ (++
10 ++
11 ++ I) _ (++
12 I) _ (-- ++ I )_(------
13 ----------------------------
14 ----------------------------
15 ----------------------------
16 ----------------------------
17 ---------------- I )_(--------
18 ---------------- I) _ (++
19 ++
20 ++
21 ++
22 ++
23 ++
24 ++ I)
25 _ (---------------- I) _ (++
26 I) _ (------------ I )_(--------
27 -------- I )_(----------------
28 ----------------------------
29 ----------------------------
30 ----------------------------
31 ----------------------------
32 ------ I )_(------------------
33 ----------------------------
34 I) return I ;}