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 / vikraman85

This can be achieved by file handling,
If r is the name of this file;The following codewil print
this prg.

#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 ?    19 Yes 23 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the use of in c?

1034


What does the error 'Null Pointer Assignment' mean and what causes this error?

1230


write a c program to print the next of a particular no without using the arithmetic operator or looping statements?

3982


What do you understand by normalization of pointers?

1064


What is a memory leak? How to avoid it?

1353


What are integer variable, floating-point variable and character variable?

1265


Is array a primitive data type in c?

1078


Write a program to reverse a given number in c language?

1124


What does the file stdio.h contain?

1073


What does c value mean?

1206


Explain the advantages of using macro in c language?

1006


What is difference between scanf and gets?

1286


How can I write a function that takes a format string and a variable number of arguments?

1061


Tell me about low level programming languages.

1137


What does return 1 means in c?

1077