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
What is typeof in c?
What is the advantage of c?
What does printf does?
Explain zero based addressing.
Define and explain about ! Operator?
How many levels deep can include files be nested?
What does calloc stand for?
Explain null pointer.
What is a list in c?
Which driver is a pure java driver
What is the purpose of the following code? Is there any problem with the code? void send(int count, short *to, short *from) { /* count > 0 assumed */ register n = (count + 7) / 8; switch (count % 8) { case 0: do { *to = *from++; case 7: *to = *from++; case 6: *to = *from++; case 5: *to = *from++; case 4: *to = *from++; case 3: *to = *from++; case 2: *to = *from++; case 1: *to = *from++; } while (--n > 0); } }
What is derived datatype in c?
How can I change the size of the dynamically allocated array?
What are the different data types in C?
What is main return c?