C Format Specifier:
The commonly used format specifiers in printf() function are:
|
Format specifier |
Description |
|
%u |
It is used to
print the unsigned integer value where the unsigned integer means that the
variable can hold only positive value. |
|
%d or %i |
It is used to print the signed integer value where signed integer
means that the variable can hold both positive and negative values. |
|
%x |
a hexadecimal
(base 16) integer |
|
%o |
It is used to print the octal unsigned integer where octal integer
value always starts with a 0 value. |
|
%X |
It is used to print the hexadecimal unsigned integer, but
%X prints the alphabetical characters in uppercase such as A, B, C, etc. |
|
%hi |
short (signed) |
|
%hu |
short (unsigned) |
|
%Lf |
long double |
|
%n |
prints nothing |
|
%i |
a decimal integer (detects the base automatically) |
|
%p |
an address (or
pointer) |
|
%e |
a floating point number in scientific notation |