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
Is sizeof a keyword in c?
How can I get random integers in a certain range?
Tell me when is a void pointer used?
What are the disadvantages of c language?
What are the functions to open and close the file in c language?
Does * p ++ increment p or what it points to?
Explain how can I right-justify a string?
Calculate the weighted average of a list of n numbers using the formula xavg = f1x1+f2x2+ ….+ fnxn where the f’s are fractional weighting factors, i.e., 0<=fi<1, and f1+f2+….+fn = 1
Why is it that not all header files are declared in every C program?
What is a structural principle?
What are the application of void data type in c?
What is use of integral promotions in c?
Explain what is the difference between a string and an array?
Explain what is meant by 'bit masking'?
write a proram to reverse the string using switch case?