a, A |
An argument of type double is converted to a floating point number in the form [-]0xh.hhhhpd, where there is one hexadecimal digit (which is nonzero if the argument is a normalized floating-point number and is otherwise unspecified) before the decimal-point wide character and the number of hexadecimal digits after it is equal to the precision.
-
If the precision is missing and FLT_RADIX is a power of 2, the precision is made sufficient for an exact representation of the value.
-
If the precision is missing and FLT_RADIX is not a power of 2, the precision is made sufficient to distinguish values of type double, except that trailing zeros are omitted.
-
If the precision is zero and the # flag is not specified, no decimal-point wide character appears.
The letters "abcdef" are used for the "a" conversion specifier and the letters "ABCDEF" for the "A" conversion specifier. The "A" conversion specifier produces a number with "X" and "P" instead of "x" and "p". The exponent always contains at least one digit, and only as many more digits as necessary to represent the decimal exponent of 2. If the value is zero, the exponent is zero. |
b, B |
An argument of type int or unsigned is converted to binary. |
c |
If no l (ell) qualifier is present, an argument of type int is converted to a wide character, and the resulting wide character is written. Otherwise, the wint_t argument is converted to wchar_t and written. |
C |
Equivalent to the lc conversion specifier. |
d, i |
An argument of type int is converted to a signed decimal in the form [-]dddd and written to the output stream. The precision specifies the minimum number of digits. If the value can be represented in fewer digits, leading zeros are added.The default precision is 1. |
e, E |
An argument of type double is converted to a decimal notation in the form [-]d.ddde[+|-]dd. The leading sign appears (subject to the format control flags) only if the argument is negative. If the argument is nonzero, the digit before the decimal point character is nonzero. The precision is used as the number of digits following the decimal point character.
-
If the precision is not specified, a default precision of 6 is used.
-
If the precision is zero and no # flag is present, the decimal point character is suppressed. The value is rounded to the appropriate number.
For E conversions, the exponent begins with the character E rather than e. The exponent always contains a two-digit number. |
f , F |
An argument of type double is converted to a decimal notation in the form [-]ddd.ddd. The leading sign appears (subject to the format control flags) only if the argument is negative.
The precision specification controls the number of digits following the decimal point character. If the precision is not specified, a default precision of 6 is used. If the precision is zero and no # flag is present, the decimal point character is suppressed. Otherwise, at least one digit is produced before the decimal-point character. The value is rounded to the appropriate number. |
g, G |
An argument of type double is converted using the f or e style of conversion depending on the value of the argument (F or E if G is specified). In either case, the precision specifies the number of significant digits that are contained in the result. The e style conversion is used only if the exponent from such a conversion would be less than -4 or greater than the precision. Trailing zeros are removed from the result, and a decimal-point character only appears if it is followed by a digit. |
n |
The number of wide characters that have been written to the output stream is assigned to the integer pointed to by the argument. No output is produced. |
o |
An argument of type unsigned is converted to an unsigned octal format in the form dddd and written to the output stream. The precision specifies the minimum number of digits. If the value can be represented in fewer digits, leading zeros are added.The default precision is 1. |
p, P |
An argument of type void * is converted to a value of type int and the value is formatted as for a hexadecimal x conversion for p and a hexadecimal X conversion for P. |
s |
If no l (ell) qualifier is present, the argument is a pointer to a character array containing a character sequence beginning in the initial shift state. Characters from the array are converted, with the conversion state described by an mbstate_t object initialized to zero before the first character is converted, and written up to (but not including) the null-terminating wide character.
-
If the precision is specified, no more than that many wide characters are written.
-
If the precision is not specified, or is greater than the size of the array, a null-terminating wide character is written.
If an l (ell) qualifier is present, the argument is a pointer to an array of type wchar_t. Wide characters from the array are written up to (but not including) a terminating null-terminating wide character.
-
If no precision is specified, or is greater than the size of the array, a null-terminating wide character is written.
-
If a precision is specified, no more than that many wide characters are written.
|
S |
Nonstandard conversion. The argument is a pointer to an array of character type with a preceding length specifier. No special provisions are made for multibyte characters. Characters from the array are written up to the indicated length.
If precision is specified, no more than that many characters are written. |
U |
Equivalent to the ls conversion specifier. |
u |
An argument of type int is converted to an unsigned decimal notation and written to the output stream. The precision specifies the minimum number of digits. If the value can be represented in fewer digits, leading zeros are added.The default precision is 1. |
x, X |
An argument of type unsigned is converted to an unsigned hexadecimal notation and written to the output stream. The default precision is 1, but if more digits are required, leading zeros are added.
Hexadecimal notation uses digits (0 through 9) and characters (a through f or A through F) for x or X conversions respectively. Subject to the alternate-form control flag, 0x or 0X is affixed to the output |
% |
A % wide character is written to the output stream. No arguments are converted. The entire conversion specification is %%. |