printf self

Below C code will print the source code itself.


char buf[100][1000] int cur=-1

void P1(char *p) {sprintf(buf[ cur],p)} //record p to buf

void P2(char *p) { printf(p) putchar(10)} //print p and change line

void P3() {int ifor(i=0i&quot)

P1(&quotchar buf[100][1000] int cur=-1&quot)

P1(&quotvoid P1(char *p) {sprintf(buf[ cur],p)}&quot)

P1(&quotvoid P2(char *p) { printf(p) putchar(10)}&quot)

P1(&quotvoid P3() {int ifor(i=0i&quot)

P2(&quotchar buf[100][1000] int cur=-1&quot)

P2(&quotvoid P1(char *p) {sprintf(buf[ cur],p)}&quot)

P2(&quotvoid P2(char *p) { printf(p) putchar(10)}&quot)

P2(&quotvoid P3() {int ifor(i=0i

Technorati Tags: , , ,