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
Explain what is the benefit of using const for declaring constants?
What is the time and space complexities of merge sort and when is it preferred over quick sort?
Which header file should you include if you are to develop a function which can accept variable number of arguments?
in multiple branching construct "default" case is a) optional b) compulsarily c) it is not include in this construct d) none of the above
Write a program in c to replace any vowel in a string with z?
What does void main () mean?
Explain what is the difference between a string copy (strcpy) and a memory copy (memcpy)? When should each be used?
How can a program be made to print the line number where an error occurs?
Explain what is the benefit of using #define to declare a constant?
In C programming, what command or code can be used to determine if a number of odd or even?
Is array name a pointer?
What is const and volatile in c?
What is static memory allocation?
Explain 'far' and 'near' pointers in c.
Explain how can I pad a string to a known length?