You are here:

C/some dobts in c

Advertisement


Question
dear 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.  

Answer
1. 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.

C

All Answers


Answers by Expert:


Ask Experts

Volunteer


Narendra

Expertise

I can answer questions in C related to programming, data structures, pointers and file manipulation. I use Solaris for doing C code and if you have questions related to C programming on Solaris, I will be able to help better.

Experience

6.5

Organizations belong to
Sun Microsystems

Awards and Honors
Brain Bench Certified Expert C programmer.
Advanced System Software Certified

©2012 About.com, a part of The New York Times Company. All rights reserved.