I'm looking for the whole source code of all the C standard libraries. That said, I'm looking for the source code of stdio.h, stdlib.h, string.h, math.h, etc... I would like to see how they were created. I think that it depends from platform to platform, but Linux or Windows one will be welcomed.
-
Do you want the header files (stdio.h) or the source code for the .lib and .dll files that implement the header files? – Steve Rowe Mar 12 '12 at 17:48
-
5The .h files are not "the whole source code of all the C standard libraries", they're just the headers. So which is it you actually want? The header files come with your C implementation, but the definitions of the functions themselves may not be available to you if your C implementation is not open source. Even when they are available they might not be very instructive on their own, since in some cases a standard library function just calls an OS function to do all the work. – Steve Jessop Mar 12 '12 at 17:48
-
4You probably want the GNU Libc http://www.gnu.org/software/libc/ – Basile Starynkevitch Mar 12 '12 at 17:50
4 Answers
If you want the actual implementations, as everyone else has assumed you don't, many Linux distributions currently use glibc to implement the C standard library. Common alternatives include musl libc, diet libc, uClibc, and Bionic

- 36,389
- 13
- 67
- 90
-
1uClibc says its releases are on hold, and one should use uClibc-ng https://uclibc-ng.org/ – flavio Mar 20 '19 at 18:43
PJ Plauger wrote a book about the standard C library. Includes references from the (now dated) standard, and source code.

- 91,602
- 17
- 122
- 185
Microsoft Visual Studio generally has the system headers under <InstallDir>\VC\include
, and the source, if installed, is under <InstallDir>\VC\crt\src
.

- 34,686
- 15
- 91
- 152
Whether its installed with an IDE or you have installed explicitly, you have to look in the directory "Include
" in respective location.
Ex: I use MinGW. So, I would go to
c:/MinGW/include
to find those header files. Similarly, for an IDE (say Dev-cpp), you need to go to c:/dev-cpp/include.

- 4,824
- 6
- 38
- 63