Outputs a string created by using
format and the given arguments. The
arguments are placed into the string in various places denoted by
special markers in the
Each marker starts with a percent sign (
%) and consists of the following elements,
in order. Except for the type specifier, the specifiers are all
optional. To include a percent sign in the string, use
An optional sign specifier that forces a sign (– or +) to be used on a number. By default, only the – sign is used on a number if it’s negative. Additionally, this specifier forces positive numbers to have the + sign attached.
A padding specifier denoting the character to use to pad the results to the appropriate string size (given below). Either 0, a space, or any character prefixed with a single quote may be specified; padding with spaces is the default.
An alignment specifier. By default, the string is padded to
make it right-justified. To make it left-justified, specify a dash
The minimum number of characters this element should contain. If the result would be less than this number of characters, the above specifiers determine the behavior to pad to the appropriate width.
For floating-point numbers, a precision specifier consisting of a period and a number; this dictates how many decimal digits will be displayed. For types other than float, this specifier is ignored.
Finally, a type specifier. This specifier tells
printf() what type of data ...