All 19 List of Format Specifiers in C with Examples

All 19 List of Format Specifiers in C with Examples- Updated

Print the List of Format Specifiers in C with Examples and also with Names, Descriptions, & Syntax in C Language. Now the question is what are the format specifiers, and what types of format specifiers In c programming language we need to tell the compiler about the data type what type of data is variable contains, formate specifiers, and use to tell that during input and output operations?

What Are Format Specifiers in C

Formate specifiers tell the compiler that a variable data type, in simple words we can say that we have to provide a piece of additional information to the compiler about the data type, and which type of data is program contains while taking input and output.

So basically use of formate specifiers is Used during scanf() and the printf() operations.

Format Specifiers

So the format specifiers define the data type or type of data. Below are some examples.

Examples: %c, %d, %f, and %lf etc.

Format Specifiers list in C Language
All Format Specifiers in C

What is %s and %d in C?

%s and %d are formate specifiers in C language, %s is used to take an input of string and print the string, String is a group of characters, and %d is used to take an integer as an input and output, %d is equal to the %i. Take a look at the %f format specifier.

Syntax of All Format Specifiers in C Language

  • scanf(“%lf”, &Variable_Name );
  • printf(“lf”, Variable_Name);

19 List of Format Specifiers in C with Examples

Name Description Syntax
%cSingle Characterscanf(“%c”, &Variable_Name );
%sStringsscanf(“%s”, &Variable_Name );
%hiShort(signed)scanf(“%hi”, &Variable_Name );
%hu Short(unsigned) scanf(“%hu”, &Variable_Name );
%l or %ld or %liSigned Integer(Signed Integer) scanf(“%l”, &Variable_Name );
%lfDoublescanf(“%lf”, &Variable_Name );
%LF Long Double scanf(“%LF”, &Variable_Name );
%luUnsigned integer scanf(“%lu”, &Variable_Name );
%lli or %lldSigned Integer(Long Long) scanf(“%lli”, &Variable_Name );
%lluUnsigned Integer(unsigned long long ) scanf(“%llu”, &Variable_Name );
%nPrints Nothing(No Output) printf(“%n”, Variable_Name );
%dDecimal Integer(Widely Used) scanf(“%d”, &Variable_Name );
%oOctal (Base 8) Integer scanf(“%o”, &Variable_Name );
%xHexadecimal (Base 16) Integer for Unsigned Integer scanf(“%x”, &Variable_Name );
%pAddress (Or Pointer) scanf(“%p”, &Variable_Name );
%fFloating Point Number for Floats scanf(“%f”, &Variable_Name );
%uInt Unsigned Decimal Integer scanf(“%u”, &Variable_Name );
%e or %EFloating Point Number in Scientific Notation(Float, Double) scanf(“%e”, &Variable_Name );
%% Prints % character printf(“%%”, Variable_Name );
List of Format Specifiers in C

I hope you like the List of all Format Specifiers in C with Examples. Name, Description and Syntax. Below are some FAQs.

What is %s in C Programming?

%s is used to String, the syntax of %s is scanf(“%s”, &Variable_Name );

What is %lu in C?

%lu is used for unsigned integers and the syntax is scanf(“%lu”, &Variable_Name );

What is %d in C Called?

%d is widely used for Decimal Integer.

Format Specifier for String in C?

%s is used for string in C programming language.

Format Specifier for Short Int in C?

%hu is used for Short Int(Unsigned) and %hi is used for Short Int(Signed)

1 thought on “All 19 List of Format Specifiers in C with Examples- Updated”

Comments are closed.