character |
Corresponding data type |
meaning |
d |
int |
Accept an integer value and represent it as a signed decimal integer |
hd |
Short int |
Short integer |
hu |
Unsigned short int |
Unsigned short integer |
O |
unsigned int |
Unsigned 8 decimal integer |
in |
unsigned int |
Unsigned 10 decimal integer |
x / X |
unsigned int |
Unsigned 16 hexadecimal integers, X corresponds abcdef , X- corresponds ABCDEF |
f |
float或double |
Single precision floating point or double precision floating point |
e / E |
double |
Scientific notation number representation, where "e" is represented by a case when the output "e" capitalization |
c |
char |
Character type. You can convert the entered numbers to the corresponding characters according to the ASCII code |
s / S |
char * / wchar_t * |
String . Output the characters in the string up to the null character in the string (the string ends with '\ 0' , this '\ 0' is the null character) |
p |
void * |
To 16 output hexadecimal form pointers |
% |
% |
Output a percent sign |
printf additional format
character |
meaning |
l |
Append in front of d, u, x, o to represent long integer |
- |
Align left |
m ( representing an integer ) |
Data minimum width |
0 |
Fill the front of the output with 0 until it fills the specified column width. It cannot be used together- |
N ( representing an integer ) |
The width is at least n bits is not enough to fill with spaces |