Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

Is sizeof a keyword in c?

964


How can I get random integers in a certain range?

1059


Tell me when is a void pointer used?

1172


What are the disadvantages of c language?

1189


What are the functions to open and close the file in c language?

1033


Does * p ++ increment p or what it points to?

1117


Explain how can I right-justify a string?

1041


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

4263


Why is it that not all header files are declared in every C program?

1212


What is a structural principle?

1161


What are the application of void data type in c?

1189


What is use of integral promotions in c?

1145


Explain what is the difference between a string and an array?

1163


Explain what is meant by 'bit masking'?

1193


write a proram to reverse the string using switch case?

2931