Format Specifier of C Language

What is Format Specifier ?

Ans Format specifier is a way to tell the compiler what type of data is in a variable during taking input displaying output to the user. Printf(“This a good boy %a bf”,var); will print var with b decimal points in a ‘a’ character space. Lets to to our IDE and learn more about the format specifiers.

Example 1

Example 2

#include<stdio.h>

using namespace std;

int main()

{

int a=8;

printf(“The a value = %d”,a);

return 0;

}

#include<stdio.h>

using namespace std;

int main()

{

int a=8;

float b=12.55;

printf(“The a value = %d”,a);

printf(“The b value = %f”,b);

return 0;

}

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

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