Loading [MathJax]/extensions/TeX/newcommand.js
\newcommand{\ord}[1]{\mathcal{O}\left(#1\right)} \newcommand{\abs}[1]{\lvert #1 \rvert} \newcommand{\floor}[1]{\lfloor #1 \rfloor} \newcommand{\ceil}[1]{\lceil #1 \rceil} \newcommand{\opord}{\operatorname{\mathcal{O}}} \newcommand{\argmax}{\operatorname{arg\,max}} \newcommand{\str}[1]{\texttt{"#1"}}

2015年10月7日 星期三

[ print itself ] 印出自己的code

一個會輸出自己的code:
#include<stdio.h>
#define s "#include<stdio.h>%c#define s %c%s%c%cint main(){%c%cprintf(s,10,34,s,34,10,10,9,10,9,10);%c%creturn 0;%c}"
int main(){
printf(s,10,34,s,34,10,10,9,10,9,10);
return 0;
}
view raw print self.cpp hosted with ❤ by GitHub

可以看一下輸出:http://codepad.org/ZFGeRjkn

沒有留言:

張貼留言