How do you write a program which produces its own source
code as its output?
Answer Posted / vivek
printitself.c
#include <stdio.h>
int main()
{
char ch;
FILE *file;
file=fopen("printitself.c","r");
while((ch=fgetc(file))!=EOF)
printf("%c",ch);
return 0;
}
Is This Answer Correct ? | 19 Yes | 2 No |
Post New Answer View All Answers
Why do we use int main instead of void main in c?
Why header file is used in c?
Is it fine to write void main () or main () in c?
Write a program to reverse a given number in c?
What is wild pointer in c with example?
What is malloc return c?
What is %g in c?
Why doesn't C support function overloading?
What is the use of clrscr?
What is function definition in c?
What is maximum size of array in c?
Explain what is the difference between null and nul?
Is using exit() the same as using return?
Is null valid for pointers to functions?
Are there any problems with performing mathematical operations on different variable types?