List of Format Specifiers in C

The below table contains the most commonly used format specifiers in C

Format Specifier

Description

%c

For character type.

%d

For signed integer type.

%e or %E

For scientific notation of floats.

%f

For float type.

%g or %G

For float type with the current precision.

%i

Unsigned integer

%ld or %li

Long

%lf

Double

%Lf

Long double

%lu

Unsigned int or unsigned long

%lli or %lld

Long long

%llu

Unsigned long long

%o

Octal representation

%p

Pointer

%s

String

%u

Unsigned int

%x or %X

Hexadecimal representation

%n

Prints nothing

%%

Prints % character

Format Specifiers in C

The format specifier in C is used to tell the compiler about the type of data to be printed or scanned in input and output operations. They always start with a % symbol and are used in the formatted string in functions like printf(), scanf, sprintf(), etc.

The C language provides a number of format specifiers that are associated with the different data types such as %d for int, %c for char, etc. In this article, we will discuss some commonly used format specifiers and how to use them.

Similar Reads

List of Format Specifiers in C

The below table contains the most commonly used format specifiers in C...

Examples of Format Specifiers in C

1. Character Format Specifier – %c in C...

Input and Output Formatting

...

FAQs on C Format Specifiers

...