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
#define f(g,h) g##h main O int i=0 int var=100 ; print f ("%d"f(var,10));} wat would be the output??
hi to every one .. how to view table pool after creating the pooled table? plz help me.. if any knows abt this ..
What is c definition?
Write a program that takes a 5 digit number and calculates 2 power that number and prints it(should not use big integers and exponential functions)
void main(){ int a; a=1; while(a-->=1) while(a-->=0); printf("%d",a); }
When do you not use the keyword 'return' when defining a function a) Always b) Never c) When the function returns void d) dfd
Is it possible to use curly brackets ({}) to enclose single line code in c program?
What are the storage classes in C?
What is c mainly used for?
How are portions of a program disabled in demo versions?
where are auto variables stored? What are the characteristics of an auto variable?
What is static function in c?
What is binary tree in c?
i have to apply for rbi before that i need to know the the syllabus for the entrance questions. whethet it may be aps or techinical
What kind of structure is a house?