C/some dobts in c
Expert: Narendra - 5/29/2006
Questiondear sir,
i have some interesting doubts in c.
1)How to write a program which produces its own source code as its output?
2)How can I find the day of the week given the date?
3)Why doesn't C have nested functions?
can u please give me logic behind these questions.
i hope u will provide me enough information
thank you.
Answer1. Open your source code from your program.
Read it and write to screen.
Do this till the end of file.
2. This is not a C programming question.
Rather it is a mathematical question.
If you know the mathematical answer, then the same can be used to write a C program.
3. I am not Kernighan, Ritchie or Ken Thompson.
They designed it and we are using it.
They didn't implement it and you must ask them, why something which you think is useful, is not included!
I don't think any other programming language has this feature.
Also, I don't think it will be useful OR lack of it is not stopping you from doing anything!
I don't want to provide logic behind any problem.
Logic is the main part and you don't need to know programming language for that.
So, you must think and find out the logic and then try to implement the same in C.
While doing the programming part, if you run into any kind of problem, I will be more eager to help you out.