1. Conversion specifier
Conversion instructions |
Output |
%a |
Floating-point numbers, hexadecimal numbers, and p-counting methods |
%A |
Floating-point numbers, hexadecimal numbers, and p-counting methods |
%c |
A character |
%d |
Signed Decimal |
%e |
Floating-point number, E-counting method |
%E |
Floating-point number, E-counting method |
%f |
Floating-point, decimal-counting method |
%g |
Automatically select the%f or%e.%e format when the exponent is less than-4 or greater than or equal to the precision based on the value |
%G |
Automatically select the%f or%e.%e format when the exponent is less than-4 or greater than or equal to the precision based on the value |
%i |
Signed decimal with D |
%o |
Unsigned 8 binary |
%p |
Pointer |
%s |
String |
%u |
unsigned decimal |
%x |
Use a hexadecimal 0f unsigned integer |
%x |
Use a hexadecimal 0F unsigned integer |
%% |
Print a percent semicolon |
2. Conversion Descriptor Modifiers
Modifier |
Significance |
Sign |
Five flags:-, +, space, #和0 |
Digit (s) |
Field width Minimum value e.%4d |
. Digit (s) |
Precision. Corresponds to%e,%e, and%f conversions, which are the digits of the number that will be printed to the right of the decimal point. |
H |
Used with integer conversions to represent an integer type of short |
hh |
Used with integer conversion specifiers to represent a singed char or unsigned char |
L |
Used with integer conversions to represent an integer type of long |
L |
Used with floating-point type conversions to indicate a float type of type long |
T |
Used in conjunction with integer conversions to represent a ptrdiff_t |
Z |
Used with integer conversions to represent a size_t (sizeof return type) E.%ZD |
|
|
3. Logo
Span style= "FONT-SIZE:14PX;" > - |
Project left-aligned E. "%-20s" | /tr>
+ |
displays the sign of the value E. "+6.2f" |
(space) span> |
signed with a leading space; if negative, displays a minus sign |
Span style= "FONT-SIZE:14PX;" > # |
E.% #o |
0 |
For all number formats, the field width is filled with leading zeros instead of spaces, or if the specified precision is omitted. |
C printf () function conversion specifier