xxxxxxxxxx
strings of the format "%d" are called format specifiers
they anticipate an input of a certain type "specified" by the so called conversion character
in C for instance conversion characters are: %[*][max_field]conversion_character
d decimal
c character
s string
f float
x hexadecimal
xxxxxxxxxx
%c Character
%d Signed integer
%e / %E Scientific notation of floats
%f Float values
%g / %G Similar as %e or %E
%hi Signed integer (short)
%hu Unsigned Integer (short)
%i Unsigned integer
%l / %ld / %li Long
%lf Double
%Lf Long double
%lu Unsigned int or unsigned long
%lli / %lld Long long
%llu Unsigned long long
%o Octal representation
%p Pointer
%s String
%u Unsigned int
%x / %X Hexadecimal representation
%n Prints nothing
%% Prints % character
xxxxxxxxxx
A format specifier is a sequence formed by an initial percentage sign (%)
indicates a format specifier, which is used to specify the type and format of
the data to be retrieved from the stream and stored into the locations pointed
by the additional arguments. In short it tell us which type of data to store
and which type of data to print.
The format specifier is used during input and output. It is a way to tell the
compiler what type of data is in a variable during taking input using scanf()
or printing using printf(). Some examples are %c, %d, %f, etc.
The format specifier in printf() and scanf() are mostly the same but there is
some difference