The printf family of functions

Printf is the main print function in C. It has many variants like fprintf (prints into a file) or sprintf (prints into a string) as well as its reverse functions (scanf etc.) which take an input and dissemble it into different parts. The syntax of all those functions is pretty similiar. First comes a so called format string and then a variable number of parameters.

   int printf(const char *format, .....);

"const char* format" is the format string. It tells the printf function how many parameters and of which type follow. Now we can guess how the code for printf might look (symbolicly):

   int printf(const char *format, .....) {
      1. read the format string and look for 
         special characters
      2. List those special characters and
         get the parameters for which they stand in 
      3. Display every parameter in the requested
         format.
      4. Tell caller how many parameters were
         processed. }