'How can I find source code of printf in macOS?

Sorry for my bad english.

I'm using macOS 12.3 in M1 Pro MacBook Pro

I want to know about source code of printf in C standard library.

I can find stdio.h file in usr/include directory.

But I can't find printf.c or stdio.c file in same directory.

And I think Apple Open Source's printf.c is too complicate, dosen't looks like a real code in macOS and dosen't helpful for me. Is that Apple Open Source printf.c code is really used in macOS?

https://opensource.apple.com/source/xnu/xnu-201/osfmk/kern/printf.c.auto.html



Solution 1:[1]

The newest Apple Open Source libc implementation of vfprintf (which is the generic underlying function that plain printf calls) can be found here on opensource.apple.com.

It's about 1400 lines, and yes, it is complex.

Some other alternate implementations (which are complex too) are:

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1