This topic has been archived. It cannot be replied.
-
工作学习 / 专业技术讨论 / c的一个面试问题,How do you write a program which produces its own source code as its output? 我不会,所以请教那位高手给个例子.谢谢先.
-mike20030405(麦客);
2006-8-15
(#3142979@0)
-
if you could write it, you can win Turing Award. Also, there is something named Google.
-ice(Mt. Rushmore);
2006-8-15
(#3142990@0)
-
因为是c语言,源码和执行码是分离的,所以我写了一个小程序,叫test.c,编译成test,执行,输出的代码再写入test.c.(test执行的过程很简单,就是读test.c,写入另一个文件tmp.c,然后move tmp.c到test.c就完了)。我的疑问是:这个问题是否有更深层的意思?
-mike20030405(麦客);
2006-8-15
{28}
(#3143000@0)
-
恭喜你,你错了这道题目.其实很简单,考的是一个预定义的宏,这题目出得差,估计EMPLOYER是一个不怎么懂技术的公司.
-iwantcar(恶疾,时日无多,戒网);
2006-8-15
(#3143036@0)
-
thanks.
-mike20030405(麦客);
2006-8-16
(#3145803@0)
-
1.use complete path name at compiling time. 2. run software at local node. 3. use __FILE__ to get the file at running time.
-ccloafer(梦游加拿大);
2006-8-15
(#3143214@0)
-
thanks, very detailed.
-mike20030405(麦客);
2006-8-16
(#3145804@0)
-
你自己google一下巴,主动一点好。唉
-4jobs(4jobs);
2006-8-15
(#3143228@0)
-
thanks
-mike20030405(麦客);
2006-8-16
(#3145805@0)
-
#define q(k)main(){return!puts(#k"\nq("#k")");}
q(#define q(k)main(){return!puts(#k"\nq("#k")");})
-fqca1999(大脑袋);
2006-8-15
(#3144797@0)
-
高啊。可是,看不懂。
-mike20030405(麦客);
2006-8-16
(#3145807@0)