How do you write a program which produces its own source
code as its output?
Answer Posted / abhishek
#include <stdio.h>
static char prog[] = "#include <stdio.h>%c%cstatic char prog[] = %c%s%c;%c%cint main(void)%c{%c printf(prog, 10, 10, 34, prog, 34, 10, 10, 10, 10, 10, 10, 10);%c return 0;%c}%c";
int main(void)
{
printf(prog, 10, 10, 34, prog, 34, 10, 10, 10, 10, 10, 10, 10);
return 0;
}
| Is This Answer Correct ? | 1 Yes | 2 No |
Post New Answer View All Answers
What is scanf () in c?
What is the best way to store flag values in a program?
I was asked to write a program in c which when executed displays how many no.of clients are connected to the server.
Write a program to generate the Fibinocci Series
What is malloc return c?
Explain what is a 'locale'?
What is the value of a[3] if integer a[] = {5,4,3,2,1}?
Is null equal to 0 in sql?
What is the purpose of void pointer?
I just typed in this program, and it is acting strangely. Can you see anything wrong with it?
What is advantage of pointer in c?
What is the use of static variable in c?
please explain every phase in the "SDLC" in the dotnet.
a value that does not change during program execution a) variabe b) argument c) parameter d) none
Hi how many types of software editions are there and their difference (like home editions, enterprise, standard etc) can u please help me