this program will print source code as its output.This program is compiled and executed successfully.Now let us see program
Program:
#include<stdio.h>
#include<conio.h>
main()
{
FILE *fp;
char c;
clrscr();
fp=fopen(__FILE__,"r");
c=fgetc(fp);
while(c!=EOF)
{
printf("%c",c);
c=fgetc(fp);
}
getch();
}
Output:
Program:
#include<stdio.h>
#include<conio.h>
main()
{
FILE *fp;
char c;
clrscr();
fp=fopen(__FILE__,"r");
c=fgetc(fp);
while(c!=EOF)
{
printf("%c",c);
c=fgetc(fp);
}
getch();
}
Output: