programming-examples/c/_Basic/C Program to Display its own Source Code as its Output.c

19 lines
306 B
C
Raw Normal View History

2019-11-15 12:59:38 +01:00
/*
* C Program to Display its own Source Code as its Output
*/
#include <stdio.h>
int main()
{
FILE *fp;
char ch;
fp = fopen(__FILE__,"r");
do
{
ch = getc(fp);
putchar(ch);
}
while (ch != EOF);
fclose(fp);
return 0;
}