Printf Format Specifiers in C
Printf format specifiers and special printf characters in C programming with output, and meaning are listed below. You can use the following to work with values.
Printf Format Specifiers
| Specifier |
Output |
| %c |
character. |
| %d or %i |
decimal (integer) number (base 10). |
| %e |
exponential floating-point number. |
| %f |
floating-point number. |
| %i |
integer (base 10). |
| %o |
octal number (base 8). |
| %s |
a string of characters. |
| %u |
unsigned decimal (integer) number. |
| %x |
number in hexadecimal (base 16). |
| %% |
print a percent sign. |
| \% |
print a percent sign. |
| %E |
Scientific notation (mantissa/exponent) using E character. |
| %g |
Uses the shorter of %e or %f. |
| %G |
Uses the shorter of %E or %f. |
| %X |
Unsigned hexadecimal integer (capital letters). |
| %p |
Pointer address. |
| %n |
Nothing printed. |
Special Printf Characters
| Characters |
Meaning |
| \a |
audible alert |
| \b |
backspace |
| \f |
form feed |
| \n |
newline, or linefeed |
| \r |
carriage return |
| \t |
tab |
| \v |
vertical tab |
| \\ |
backslash |