You can require that output be padded by leading characters. The padding specifier should directly follow the percent sign that begins a conversion specification.
Example:
printf("%04d", 36);
// prints "0036"
You can specify the number of spaces within which your output should sit. The field width specifier is an integer that should be placed after the percent sign that begins a conversion specification (assuming no padding specifier is defined).
Example:
printf ("%25s\n", "Book");
// prints 25 spaces out
That much, you may know. Here are my questions:
1. In example one, how would it know if what to do if I were to have padded the number 24 spaces out, rather than just four? Maybe it knows that the padding character can only be one character. This makes enough sense... but...
2. In example two, how does the printf() know that I want 21 spaces rather than to pad the output to 5 spaces with 2's?