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
How can I get the current date or time of day in a c program?
Why c language?
What is the difference between array and structure in c?
Describe explain how arrays can be passed to a user defined function
Write a program to reverse a given number in c?
What tq means in chat?
how to make a scientific calculater ?
What is the best style for code layout in c?
What is unary operator?
What is conio h in c?
Explain spaghetti programming?
The file stdio.h, what does it contain?
What is FIFO?
An arrangement of information in memory in such a way that it can be easily accessed and processed by a programming language a) string b) data structure c) pointers d) array
Explain how do you sort filenames in a directory?