How do you write a program which produces its own source
code as its output?
Answer Posted / yogesh bansal
#include <stdio.h>
int main()
{
FILE *file;
char filename[]="outputsourcecode.c";
char str[125];
file=fopen(filename,"r");
if(file == NULL)
{
printf("cannot open the file");
exit(1);
}
while(!feof(file))
{
if(fgets(str,125,file))
{
printf("%s", str);
}
}
return 0;
}
this is a working code.
| Is This Answer Correct ? | 4 Yes | 0 No |
Post New Answer View All Answers
Describe static function with its usage?
Explain built-in function?
Is c procedural or functional?
shorting algorithmS
write a program to convert a expression in polish notation(postfix) to inline(normal) something like make 723+* (2+3) x 7 (not sure) just check out its mainly printing expression in postfix form to infix.
How variables are declared in c?
What is context in c?
Explain why can’t constant values be used to define an array’s initial size?
Why is c called c?
How many main () function we can have in a project?
Explain what is the stack?
What is extern variable in c with example?
what is the differnce between programing langauge and tool? is sas is a programing langauge r tool?
Are negative numbers true in c?
What does s c mean on snapchat?