Categories
2. Input and Output

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 TypeFormat 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

Leave a Reply

Your email address will not be published. Required fields are marked *