--- In [email protected], "Paul Herring" <[EMAIL PROTECTED]> wrote: > > On 5/16/07, Dipak Gaigole <[EMAIL PROTECTED]> wrote: > > Hi all, > > > > While googling for some c puzzles/questions i found one good question. > > > > Que: Write a small C program, which while compiling takes another > > program from input terminal, and on running gives the result for the > > second program. (NOTE: The key is, think UNIX). > > Suppose, the program is 1.c > > Then, while compiling > > $ gcc -o 1 1.c > > int main() > > { > > printf("Hello World\n"); > > } > > ^D > > $ ./1 > > Hello World > > $ > > After a quick google I found it on > http://ajayfromiiit.wordpress.com/2006/07/ (search the page for input > terminal) - The question, as stated, doesn't make sense - it seems to > imply that the compilation process itself should take some input from > stdin. > > The only other thing it remotely suggests is some sort of quine > (program 1,) who's output produces the source for another 'quine' > (program 2) which outputs the source for program 1, ad-infinitum. > Search for "level 2" on > http://forums.worsethanfailure.com/forums/thread/114207.aspx > > > -- > PJH > "I contend that we are both atheists. I just believe in one fewer god > than you do. When you understand why you dismiss all the other > possible gods, you will understand why I dismiss yours." > -- Stephen Roberts >
Paul, Thanks for the information. Dipak
