write a program wch produces its own source code aas its
output?
Answer / guest
#include <stdio.h>
int main(int argc, char** argv)
{
/* This macro B will expand to its argument, followed by a
printf
command that prints the macro invocation as a literal
string */
#define B(x) x; printf(" B(" #x ")\n");
/* This macro A will expand to a printf command that prints
the
macro invocation, followed by the macro argument itself. */
#define A(x) printf(" A(" #x ")\n"); x;
/* Now we call B on a command to print the text of the
program
up to this point. It will execute the command, and then
cause
itself to be printed. */
B(printf("#include <stdio.h>\n\nint main(int argc, char**
argv)\n{\n/*
This macro B will expand to its argument, followed by a
printf\n
command that prints the macro invocation as a literal
string
*/\n#define B(x) x; printf(\" B(\" #x \")\\n\");\n\n/*
This macro
A will expand to a printf command that prints the\n
macro invocation, followed by the macro argument itself.
*/\n#define A(x)
printf(\" A(\" #x \")\\n\"); x;\n\n/* Now we call B on
a command
to print the text of the program\n up to this point. It
will execute
the command, and then cause\n itself to be printed.
*/\n"))
A(printf("/* Lastly, we call A on a command to print the
remainder
of the program;\n it will cause itself to be printed,
and then
execute the command. */\n}\n"))
/* Lastly, we call A on a command to print the remainder of
the program;
it will cause itself to be printed, and then execute the
command. */
}
Is This Answer Correct ? | 2 Yes | 4 No |
Here is alphabets : abcdefgh 1) how to reverse. as hgfedcba 2) after reversal, how to group them in a pair hg fe dc ba.
Can you please explain the difference between strcpy() and memcpy() function?
Write a program to swap two numbers without using third variable in c?
Give the Output : * * * * * * * * * *
program to find the second largest word in a paragraph amongst all words that repeat more thn twice
Explain the difference between malloc() and calloc() in c?
if we take a number as a char then can we manipulate(add, subtract) on this number
send me the code of flow chart generator using C-programming language amd this code should calculate the time and space complexity of the given progran and able to generate flowchart according to the given program?
What are the Advantages of using macro
write the program to find multiplication of 2-D matrix??????????
Explain how can I convert a string to a number?
Explain what will be the outcome of the following conditional statement if the value of variable s is 10?