This c program produces its own source code as its output
fclose(fp);
fclose(fp);
such a program is called a quine.This kind of program takes no input and produces a copy of its own source code as its only output.
#include <stdio.h>
int main(){
FILE *fp;
char c;
fp=fopen(_FILE_,"r");
do{
c=getc(fp);
putchar(c);
}while(c!=EOF)
fclose(fp);
return 0;
}
output
#include <stdio.h>
int main(){
FILE *fp;
char c;
fp=fopen(_FILE_,"r");
do{
c=getc(fp);
putchar(c);
}while(c!=EOF)
fclose(fp);
return 0;
}
No comments:
Post a Comment