Format Specifiers in C

By | October 5, 2016

In this article you will get list of format specifiers in C.

Format specifier is used to specify the data type while reading or writing. For example if you want to print value of an integer type variable then you have to use %d in printf() function. Take below example.


As you can see that I have used %d while reading and printing integer value.

C language has various format specifiers that I have listed below.


List of Format Specifiers in C

Data Type Format Specifier
char %c
signed char %c (or %hhi for numerical output)
unsigned char %c (or %hhu for numerical output)
short int
signed short
signed short int
unsigned short

unsigned short int



signed int

%i or %d

unsigned int


long int

signed long

signed long int

unsigned long

unsigned long int

long long

long long int

signed long long

signed long long int

unsigned long long

unsigned long long int

float %f (promoted automatically to double for printf())
double %f (%F)

(%lf (%lF) for scanf())

%g  %G

%e  %E (for scientific notation)

long double %Lf  %LF

%Lg  %LG

%Le  %LE


Comment below if you found anything incorrect or missing in above list of format specifiers in C.


Leave a Reply

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