The type character is the only required format field; it appears after any optional format fields. The type character determines whether the associated argument is interpreted as a character, string, or number. The typesC,N,P, AndS, And the behaviorCAndSWithPrintfFunctions, are Microsoft extensions and are not ANSI compatible.
Character |
Type |
Output Format |
C |
Int orWint_t |
When usedPrintfFunctions, specifies a single-byte character; when usedWprintfFunctions, specifies a wide character. |
C |
Int orWint_t |
When usedPrintfFunctions, specifies a wide character; when usedWprintfFunctions, specifies a single-byte character. |
D |
Int |
Signed decimal integer. |
I |
Int |
Signed decimal integer. |
O |
Int |
Unsigned octal integer. |
U |
Int |
Unsigned decimal integer. |
X |
Int |
Unsigned hexadecimal integer, using "abcdef ." |
X |
Int |
Unsigned hexadecimal integer, using "abcdef ." |
E |
Double |
Signed value having the form [-] d.DdddE[Sign] Dd [d] Where D is a single decimal digit, dddd is one or more decimal digits, Dd [d] is two or thdecree digits depending on And size of the exponent, andSignIs + or -. |
E |
Double |
Identical toEFormat variable t thatERatherEIntroduces the exponent. |
F |
Double |
Signed value having the form [-] dddd.Dddd, where dddd is one or more decimal digits. the number of digits before the decimal point depends on the magnqueue of the number, and the number of digits after the decimal point depends on the requested precision. |
G |
Double |
Signed value printed inFOrEFormat, whichever is more compact for the given value and precision.EFormat is used only when the exponent of the value is less than-4 or greater than or equal to the precision argument. trailing zeros are truncated, And the decimal point appears only if one or more digits follow it. |
G |
Double |
Identical toGFormat, encoding t thatE, RatherE, Introduces the exponent (where appropriate ). |
A |
Double |
Signed hexadecimal double precision floating point value having the form [−] 0xH. hhhh P ±DD, whereH. hhhhAre the hex digits (using lower case letters) of the mantissa, and DD are one or more digits for the exponent. The precision specifies the number of digits after the point. |
A |
Double |
Signed hexadecimal double precision floating point value having the form [−] 0xH. hhhh P ±DD, whereH. hhhhAre the hex digits (using capital letters) of the mantissa, and DD are one or more digits for the exponent. The precision specifies the number of digits after the point. |
N |
Pointer to integer |
Number of characters successfully written so far to the stream or buffer; this value is stored in the integer whose address is given as the argument. See Security note below. |
P |
Pointer to void |
Prints the argument as an address in hexadecimal digits. |
S |
String |
When usedPrintfFunctions, specifies a single-byte-character string; when usedWprintfFunctions, specifies a wide-character string. characters are printed up to the first null character or untilPrecisionValue is reached. |
S |
String |
When usedPrintfFunctions, specifies a wide-character string; when usedWprintfFunctions, specifies a single-byte-character string. characters are printed up to the first null character or untilPrecisionValue is reached. |
NoteIf the argument corresponding% SOr% SIs a null pointer, "(null)" will be printed.