If your implementation ships with (or otherwise makes available) the source code for its runtime library, that's where you would find it.
You should first ask yourself whether that's necessary. The whole point of the ISO standard is to ensure every implementation is the same abstract machine, regardless of the underlying code.
That means you should generally just code to the standard without worrying whether, for example, qsort
is implemented as a quick sort, merge sort or even, should it be not too concerned with performance, a bubble sort or bogosort.
Just be aware that it will follow the rules as laid out in the standard.
If you still want to examine the source for the library, something like gcc
will use glibc
(available here) and Visual C++ source code ships with the product as well. On my version (VS 2013), it's in C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\crt\src
.
For example, since you expressed an interest in one of your comments about the abs()
function, here's the VC++ variant from abs.c
in that directory listed above:
int __cdecl abs (int number) {
return (number >= 0 ? number : -number);
}
There's not much there that's surprising but something like output.c
, which provides the common code for all the printf
-style functions, clocks in at about two and a half thousand lines.