RetroFed Forums
Your home away from modern life.
Where do I find the code of standardized functions?
Post Reply
AuthorMessage
printf("%s", name); piefed.blahaj.zone akunohana@piefed.blahaj.zone
Joined: 2026-03-30
Quote

For instance, I wanted to see how printf is written. I looked into the stdio.h file, but there, I could only find the function declaration, no definition.

12   Original
Thomas Douwes sopuli.xyz thomasdouwes@sopuli.xyz
Joined: 2023-06-07
#2 · (edited) Quote Reply

There are multiple implementations, the one often found on linux is glibc, you can find the source code for that online. printf is going to be a small wrapper for vfprintf though, so that is where you will probably find what you are looking for

11
printf("%s", name); piefed.blahaj.zone akunohana@piefed.blahaj.zone
Joined: 2026-03-30
#3 · Quote Reply

There are multiple implementations, the one often found on linux is glibc, you can find the source code for that online. printf is going to be a small wrapper for vfprintf though, so that is where you will probably find what you are looking for

Thanks!

1
avidya programming.dev avidya@programming.dev
Joined: 2026-05-10
#4 · Quote Reply

Check out GLIBC, the standard libc implementation for GNU/Linux, or the easier to read, minimalist, alternative libc MUSL.

Bootlin, runs the Elixir Code Cross Referencer that lets you easily hop between files. For instance, Here is the code for printf in GLIBC.

4
☭可爱小猫☭ programming.dev ghodawalaaman@programming.dev
Joined: 2025-12-11
#5 · Quote Reply

if you want to see how you can write your own: https://linux-is-best.pckt.blog/writing-your-own-print-function-16xt8wv

1
Post Reply
Back to top