How do you write a program which produces its own source code as its output?

Questions by svsuresh

Showing Answers 1 - 1 of 1 Answers

sambit otta

  • Jul 7th, 2006
 

open the selfcopy.c file inside its code---selfcopy.c---#include #include#include main() { FILE *fopen(), *fp; int c ; printf("THE OUTPUT IS THE PROGRAM ITSELFn"); fp = fopen("selfcopy.c","r" ); c= getc( fp ) ; while ( c != EOF ) { putchar( c ); c = getc ( fp ); } fclose( fp ); }

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions