- Feb 28, 2002
- 2,431
- 0
- 0
Hi, Just out of curiosity, is it possible to write a program that prints out its own source code when executed? Language doesn't matter.
Thanks!
Thanks!
Originally posted by: ThisIsMatt
Not sure how you mean. A program could just print out a text file of its original source code, sure. It maybe could use a decompiler to decompile itself when ran...
Should be possible in any higher level language. That's not very difficult at all.Originally posted by: hamburglar
Originally posted by: ThisIsMatt
Not sure how you mean. <STRONG>A program could just print out a text file of its original source cod</STRONG>e, sure. It maybe could use a decompiler to decompile itself when ran...
That is what I mean. Is it possible in some programming language?
Originally posted by: lukatmyshu
Dude ... don't ask homework questions to CS 70 on ATOT. In any case it can't print out a text file 'cuz the problem statement specifically states that you can't use any file-systems. I'll give you a hint though ... use a #define statement in C.