write a C program to print the program itself ?!

Answer Posted / swamy

#include<stdio.h>
#include<conio.h>
int main()
{
FILE * fp = NULL;
char c = '\0';
fp = fopen(__FILE__,"r");
while(!feof(fp))
{
c = fgetc(fp);
printf("%c",c);
}
getch();
}

Is This Answer Correct ?    4 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

At a shop of marbles, packs of marbles are prepared. Packets are named A, B, C, D, E …….. All packets are kept in a VERTICAL SHELF in random order. Any numbers of packets with these names could be kept in that shelf as in this example: bottom of shelf ---> [AAAJKRDFDEWAAYFYYKK]-----Top of shelf. All these packets are to be loaded on cars. The cars are lined in order, so that the packet could be loaded on them. The cars are also named [A, B, C, D, E,………….]. Each Car will load the packet with the same alphabet. So, for example, car ‘A’ will load all the packets with name ‘A’. Each particular car will come at the loading point only once. The cars will come at the loading point in alphabetical order. So, car ‘B’ will come and take all the packets with name ‘B’ from the shelf, then car ‘C’ will come. No matter how deep in the shelf any packet ‘B’ is, all of the ‘B’ packets will be displaced before the ‘C’ car arrives. For that purpose, some additional shelves are provided. The packets which are after the packet B, are kept in those shelves. Any one of these shelves contains only packets, having the same name. For example, if any particular shelf is used and if a packet with name X is in it, then only the packets having names X will be kept in it. That shelf will look like [XXXXXXX]. If any shelf is used once, then it could be used again only if it is vacant. Packets from the initial shelf could be unloaded from top only. Write a program that finds the minimum total number of shelves, including the initial one required for this loading process.

1730


how to count no of words,characters,lines in a paragraph.

3898


Explain modulus operator.

590


How is a null pointer different from a dangling pointer?

555


What is calloc()?

623






What are high level languages like C and FORTRAN also known as?

680


What is a keyword?

740


What is data structure in c language?

599


An expression to whose value an operater is applied a) operand b) variable c) constant d) all of the above

653


What is zero based addressing?

705


Who developed c language?

635


What is the size of structure in c?

696


What is hashing in c language?

609


What is a pointer on a pointer in c programming language?

616


What is a function in c?

567