What is format specifier ?
Format specifier is a way to tell the compiler what type of data is in a variable during taking input or displaying output .
Format specifier type
%c used to print the character
%d used to print the integer
% f used to print float values
%lf used to print the double integer
%s used to print the string
Example :-
* To print the intger value :-
printf( "%d" ,d);
* To print the float value :-
printf( "%f" ,f);
* To print the character :-
printf( "%c" ,c);
* To print the string :-
printf( "%s" ,s);
What is Escape Sequence ?
An escape sequence is a sequence of characters which are used in formatting the output . They don't display on the screen while printing.
=> Types of Escape Sequence in C :-
Escape Description
\t Inserts a tab.
\b Inserts a backspace.
\n Inserts a new - line.
\r Inserts a carriage return.
\f Inserts a form feed.
\' Inserts a single quote character.
\" Inserts a double quote character.
\\ Inserts a backslash character.
I
n the next article , we will discuss about statements in C just like IF ELSE , SWITCH CASE etc. So keep reading and follow us ........
Good one
ReplyDelete