You may notice that we used %d to print integer number but %f for fraction. This is called format specifier in C. There are different format specifier to print different data type. List of most used format specifier and example are given below:

Data type Format specifier Example
int %d or %i
long int %ld
float %f
double %lf
char %c

Next Previous