The first character of the format parameter is always a percent sign (%). The last character of format is a letter code that determines the type of formatting. One or more format modifiers can appear between the first and last character of the format argument (see below). The possible letter codes are as follows:
unsigned octal number without a leading zero
unsigned hexadecimal number without a leading 0x
unsigned decimal number
print characters until either `\0' or the number of characters given in the precision is reached
engineering notation (m.dddddd e+exponent). If precision is greater than fractional part, prints trailing zeros
engineering notation without trailing zeros or trailing decimal point
print the character `%'
Note that a separate formatting specification must be provided for each expression to be printed. For example, the statement:
printf("My name is %s%s\n", "Arthur", "Dent");
prints the statement "My name is Arthur Dent" to standard output. Without the second "%s," the second expression (Dent) would have been ignored.
The output generated by a particular formatting code can be modified. Three types of modifiers can appear between the percent sign (%) and the format code character:
A hyphen (-) indicates that the printed output is to be left justified in its field.
A number, by itself or to the left of a decimal point, indicates how many characters the field should be padded. When this number is preceded by a 0, the padding occurs with zeros to the left of the printed value.
A number to the right of a decimal point indicates the maximum width of the printed string or how many digits are printed to the right of the output decimal point.