What happens behind the scenes when printf() function is executed.

nitin(35)
Published in
#c
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

  1. 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.
  2. The OS calls the console, which may be a TTY in text mode or a GUI window
  3. The console or window manager calls the graphics driver to copy the font pixels onto the screen
  4. The graphics driver may either manually copy some pixels or directly tell the GPU hardware
  5. The GPU finally writes the font character data into the VRAM
  6. The RAMDAC on the GPU scans the VRAM and sends the signals to the display

Source - https://www.quora.com/How-is-printf-able-to-display-the-formatted-string-on-screen-What-is-the-coding-or-anything-else-related-to-computer-architecture-behind-it/answer/Vivek-Nagarajan-1

What happens behind the scenes when printf() function is executed. | Ecency