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
What's a good way to check for "close enough" floating-point equality?
What is a built-in function in C?
How to write a multi-statement macro?
Which built-in library function can be used to match a patter from the string?
What are data types in c language?
When should structures be passed by values or by references?
What is NULL pointer?
using for loop sum 2 number of any 4 digit number in c language
how can use subset in c program and give more example
Why clrscr is used in c?
What is the purpose of realloc()?
What does c mean in basketball?
What is wrong with this initialization?
What does a pointer variable always consist of?
What are the advantages of using macro in c language?