What happens behind the scenes when printf() function is executed.
Words
137
Reading
1 min
Listen
Play
9y
printf() is a function in C that is used for displaying a string of characters on a screen. But what exactly happens exactly when it is executed?
This happens in several layers of abstraction
- The C run time library converts your printf() arguments into an array of characters and calls an OS function to write them to the standard output.
- The OS calls the console, which may be a TTY in text mode or a GUI window
- The console or window manager calls the graphics driver to copy the font pixels onto the screen
- The graphics driver may either manually copy some pixels or directly tell the GPU hardware
- The GPU finally writes the font character data into the VRAM
- The RAMDAC on the GPU scans the VRAM and sends the signals to the display