There is some way to see the source code of the functions contained in the C standard library and in the headers files like stdio.h?
Asked
Active
Viewed 676 times
-1
-
There is no single, canonical implementation of the standard library functions and headers. You very likely can find the headers of your particular implementation, however, load them into a text editor, and read them, but their exact location is implementation and configuration dependent. As for functions, many implementations are closed-source, so that you cannot look at function implementations, but open-source implementations do exist, notably [GLIBC](https://www.gnu.org/software/libc/sources.html). – John Bollinger Dec 20 '18 at 15:41
2 Answers
1
https://www.gnu.org/software/libc/ there you go. Google is the best answer in some cases!

Gixuna
- 86
- 8
-
1This is just one potential implementation. The user might be on Windows for instance, which has a different implementation using a different system interface. – johannes Dec 20 '18 at 16:04
-
-
I'm studying C from a Deitel book and i'm using CodeBlocks on Windows. I just want to see the content of the headers file like stdio.h and the source code of functions like printf scanf.... – Alex Dec 21 '18 at 19:02
0
Depends on what you want to do with it. If you only want to get some idea then you can go with Gixuna's response. If you need to see your system's exact source code you have to get it from your distribution, they may apply patches, backports. For example if you have a debian system or derivates you can say:
apt-get source libc6
RPM based systems have different methods to get their SRPMs but I'm not familiar with those.
Also, be prepared that analyzing this source code will not be a walk in the park.

soger
- 1,147
- 10
- 18