Format Specifiers for I/O

As you can see from the above examples, we use
  • %d for int
  • %f for float
  • %lf for double
  • %c for char
Here's a list of commonly used C data types and their format specifiers.
Data Type Format Specifier
int %d
char %c
float %f
double %lf
short int %hd
unsigned int %u
long int %li
long long int %lli
unsigned long int %lu
unsigned long long int %llu
signed char %c
unsigned char %c
long double %Lf