How do you write a program which produces its own source
code as its output?
Answer Posted / vivek
printitself.c
#include <stdio.h>
int main()
{
char ch;
FILE *file;
file=fopen("printitself.c","r");
while((ch=fgetc(file))!=EOF)
printf("%c",ch);
return 0;
}
| Is This Answer Correct ? | 19 Yes | 2 No |
Post New Answer View All Answers
What is default value of global variable in c?
Where are c variables stored in memory?
Write a C program to help a HiFi’s Restaurant automate its breakfast billing system. Your assignment should implement the following items: a. Show the customer the different breakfast items offered by the HiFi’s Restaurant. b. Allow the customer to select more than one item from the menu. c. Calculate and print the bill to the customer. d. Produce a report to present your complete program and show more sample output. Assume that the HiFi’s Restaurant offers the following breakfast menu: Plain Egg $2.50 Bacon and Egg $3.45 Muffin $2.20 French Toast $2.95 Fruit Basket $3.45 Cereal $0.70 Coffee $1.50 Tea $1.80
which is an algorithm for sorting in a growing Lexicographic order
what is a function method?give example?
How can I open files mentioned on the command line, and parse option flags?
What does %c mean in c?
What is %g in c?
What is maximum size of array in c?
What is union and structure?
Is exit(status) truly equivalent to returning the same status from main?
Write a code to achieve inter processor communication (mutual exclusion implementation pseudo code)?
How can I determine whether a machines byte order is big-endian or little-endian?
What are directives in c?
List at least 10 sorting methods indicating their average case complexity, worst case complexity and best case complexity.