The format specifier in C is utilized to inform the compiler about the data type to be processed during input and output operations.
They always begin with a % symbol and are employed in formatted console input/output functions like printf() and scanf(), as well as in formatted file input/output functions like fprintf() and fscanf().
Types of Format Specifiers
The Most commonly used format specifiers are given below:
| Format Specifier | Description | Data Type | Ranger | Size(Bytes) |
| %d or %i | Signed Integer | int | -2147483648 to 2147483647 | 4 |
| %f | Floating point number with six digits of precision | float | 1.2E-38 to 3.4E+38 | 4 |
| %Lf | Floating point number with extended precision | long double | 3.4E-4932 to 1.1E+4932 | 10 or 16 |
| %c | Single character | char | -128 to 127 | 1 |
| %s | String of characters | char[] | ||
| %p | Address in memory | void * | 4 or 8 | |
| %Id | Signed long integer | signed long | -2147483648 to 2147483647 | 4 |
| %lu | Unsigned long integer | unsigned long | 0 to 4294967295 | 4 |
| %lld | Unsigned long long integer | long long | -9.223.372.036.854.775.808 to 9.223.372.036.854.775.807 | 8 |
| %llu | unsigned long long | 0 to 18.446.744.073.709.551.615 | 8 | |
| %x | unsigned int | 4 | ||
| %E | double | 8 | ||
| %o | unsigned int | 4 | ||
| %u | unsigned int | 4 | ||
| %hd | short | 2 | ||
| %m | int | - | - | |
| %hu | Unsigned short integer | unsigned short integer | 0 to 65.535 | 2 |
| %g or %G | float or double | |||
| %n | Writes the number of printed characters | int * | - | - |