Format specifier in c

Format specifier in c language

This article is all about the format specifier in c language and types of format specifiers, so know about this please read the full article.

There are many types of format specifiers are available in c programming .

The function scanf() and printf() make use of conversion specifications to specify the type and size of data.

And each conversion specification must begin with a percent sign(%).

Various types of format specifier in c language :


When you are using the %c in your programming that means that the data is a character type data, not an int type data.

And in both the input and output cases we can use the %c .




void main()


char a;



printf(“output is =%c”,a);



This is an example of %c format specifier.


This generally means a decimal integer. That means when you want to print the integer value then you can use the %d where you want.

Anything lies inbetween the 0 and 9 stands for decimal integer .




void main()


int a;



printf(“output is =%d”,a)


This is an example of %d of how we use the %d in c programming.


This is a kind of format specifier or floating point number which we used .

We can use this format specifier in printf as well as in scanf also.


This is a format specifier and with the help of this format specifier, we mention a floating-point number.

Suppose we have created a variable which is float type such as- float a, so in that place, we can write the %f to display our floating-point integer.




void main()


float a;



printf(“output is %f”,a);



This is an example of float and this will holds the floating numbers.


This is also a format specifier and it is use to print decimal point values.

Mainly this is a floating input output instruction.

Through the help of these we can represent number with float and douhble.


There are many types of format specifiers are available and %hu is one of them.

And this is mainly used for the unsigned short integer.


This is used for several integer values. For decimal, for octal, and for hexadecimal also.

Decimal numbers are built up between any numbers inbetween 0 to 9.

Similarly, hexadecimal numbers are built from 0 to 9 and 10 is represents as a and this process will continue.

Octals are the numbers that are built in between 0 to 7.


This is one of the most useable format specifier in c language.

We can use this for long range or for floating point number.

This is normally used with the double data type.

And if you use the capital LF then that is used for long data double.


It is used for the short or for unsigned.


This is a format specifier which we use with an octal integer


It is use for an address or for pointer.


This is use for the strings in programming.

And strings are always written with in the double quotes.


We use this for the unsigned decimal integer. We can also use this for the address.

This will use in the pointers. So if you want to use the unsigned integer then you can easily use this specifier.


This is a format specifier use for the hexadecimal integer value.


It is a spcefier which prints nothing.


This is also a format specifier which is used for % symbol.


Here in this article, we mention the various format specifier in the c language.

If you want to learn computer programming then please follow our website and here we will update lots of informational content.

Also read

Escape sequences in c language
Keywords in c programming
Variables in c language
Operators in c language
Best youtube channel to learn c programming