Functions like printf() , scanf() , memset() , puts() etc have their declaration in header files but is there any mechanism to see the definition of these function..? This might not be a new question but i could not find the appropriate solution for this.
Asked
Active
Viewed 2,255 times
2
-
There is no mechanism. You have to get the source code elsewhere. – harper Mar 16 '15 at 13:27
-
Some environments have built in, context tools, such as right clicking a standard function and selecting help from a pull down context menu. But you can also just keep a browser page pointing to your favorite _man_ pages if Linux or MSDN if windows. – ryyker Mar 16 '15 at 13:30
-
When you say definition, is it the source code, the compiled library, or a human readable description of the function? Are you looking for man-pages? – Leonard Michlmayr Mar 16 '15 at 13:44
-
1@ Leonard Michlmayr .. i am using windows... my doubt is where the compiler looks for the definition of these function while execution ? – Rajesh Sethi Mar 16 '15 at 13:50
1 Answers
4
- Find your compilers include path (e.g. GCC solution)
- Search for the header you are interested in (e.g.
printf
should be instdio.h
or more likely another header included bystdio.h
) - Correctly configured, some IDEs will help you with that, e.g. Eclipse
The method has its limits though, because at some point the include files will get less and less Standard-C, but more and more compiler dependent. The C-standard does not prescribe the contents of standard headers. It merely states that if you write #include <stdio.h>
, you can use printf()
. That does not necessarily mean that stdio.h has some form you might expect.

Community
- 1
- 1

edgar.holleis
- 4,803
- 2
- 23
- 27
-
1
-
1I don't know, so I upvoted to counter the downvoter's action and restore you to +1. Sorry it took me 5+ years to get here. – user1717828 Oct 04 '20 at 11:30