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 the priority queues?
What do header files do?
What is the difference between struct and union in C?
Why is c fast?
Write a program to show the change in position of a cursor using c
What is the use of f in c?
main(){char *str;scanf("%s",str);printf("%s",str); }The error in the above program is: a) Variable 'str' is not initialised b) Format control for a string is not %s c) Parameter to scanf is passed by value. It should be an address d) none
What are the output(s) for the following ? #include char *f() {char *s=malloc(8); strcpy(s,"goodbye")} main() { char *f(); printf("%c",*f()='A'); }
Is it better to use malloc() or calloc()?
What is the scope of static variable in c?
What is return type in c?
What is modeling?
How can I find out if there are characters available for reading?
Can I initialize unions?
if (i = 0)printf ("True"); elseprintf("False"); Under what conditions will the above print out the string "True" a) Never b) Always c) When the value of i is 0 d) all of the above