Skip to main content

The most commonly used Format Specifiers in C

Format Specifiers in C

C Format Specifiers
(Image by - Sharma Guides | Subham232330)


* Why do we use C Format Specifiers?

Format specifiers in C are used to take inputs and print output of a type. The symbol we use in every format specifier is the %. Format specifiers tell the compiler about the type of data to be given or input and the type of data that must be printed on the screen.



* The most commonly used Format Specifiers in C :


%d or %i - A decimal integer or signed integer 

%c - Signed character 

%f - Signed float

%e - A floating-point number

%s  - A string or sequence of character 

%lf - double

%Lf - Long double 

%o - Octal integer 

%u - Short unsigned integer

%ld - Long decimal integer

%x - Hexadecimal integer

%p - Print memory address in the hexadecimal form

%hd - Short integer

%lu - Unsigned long integer

%llu - Unsigned long long integer


Comments