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

code for quick sort?

2025


What are the two types of functions in c?

1000


how to print electricity bill according to following charges first 100 units -1rs per unit for next 200 units-1.50 rs per unit without using conditions

3171


Is exit(status) truly equivalent to returning the same status from main?

1064


What is the difference between array and structure in c?

1153


what does static variable mean?

1097


What are logical errors and how does it differ from syntax errors?

1292


What is the meaning of ?

1034


What is integer constants?

1070


Which node is more powerful and can handle local information processing or graphics processing?

1312


Can true be a variable name in c?

1034


How important is structure in life?

1082


What is the difference between the expression “++a” and “a++”?

1228


What are the different types of control structures?

1040


What is the purpose of sprintf?

1128