write a C program to print the program itself ?!
Answer Posted / vinay tiwari
this can be achieved by file handling
#include<stdio.h>
void main()
{
FILE *fp;
char ch;
clrscr();
fp=fopen("file.c","r");
ch=getc(fp);
while(ch!=EOF)
{
putchar(ch);
ch=getc(fp);
}
getch();
}
| Is This Answer Correct ? | 63 Yes | 33 No |
Post New Answer View All Answers
What is the most efficient way to count the number of bits which are set in an integer?
what are the facialities provided by you after the selection of the student.
How can a program be made to print the line number where an error occurs?
What are logical errors and how does it differ from syntax errors?
What are the similarities between c and c++?
How can I direct output to the printer?
What is static function in c?
How to get string length of given string in c?
How can you find the exact size of a data type in c?
What is wrong with this declaration?
exit () is used to a) exit () terminates the execution of the program itself b) exit () terminates the execution of the loop c) exit () terminates the execution of the block d) none of the above
Why isn't it being handled properly?
What is typedf?
How can I find the modification date and time of a file?
If one class contains another class as a member, in what order are the two class constructors called a) Constructor for the member class is called first b) Constructor for the member class is called second c) Only one of the constructors is called d) all of the above