TYPES OF FORMAT SPECIFIER
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 |
HOW WE USE FORMET SPECIFIER IN C PROGRAM
#include <stdio.h>
int main()
{
// Implementation during input
int var1, var2, var3; // declaring some integer variables
// assume input given by user is 10,20,30
scanf("%d
%d %d", &var1, &var2, &var3); // taking input from user
printf("%d %d %d", var1, var2, var3);
// it will print the values input by user
}
0 Comments
Post a Comment