Here is one problem for all you programming freaks to try out.
1. Write a C/C++ (GNU) program that prints its own source code on executing.
Please give it a good thought before looking at the solution. My Solution:- for C | for C++
If you have a better solution than this please mail it to me. Or you can put it up in my Guest Book
Another one to set you thinking.
2. Write a C/C++ (GNU) program that outputs the code of a program which on executes prints the source of the first program. Its like this:- Let the programs be proga.c and progb.c
Also check out this site for similar kind of obscure C code.
Strange link Script