printf-scanf function


Output function :- printf()

printf():-
it is a pre-define function means it has reserve in c library to perform output function , it get value from memory and give output to the screen.

The function printf() is the combination of print+f=printf()

Print :-
print function prints the data stored in variables to the screen. F – format :-
the data present in memory or variables is read and formatted means converted into appropriate data type. This is done using format string with the help of conversion code that are define in c library .

Syntax of printf() function

Printf(“format string” , list of variables); Example:-
printf("%d",a);
hear %d is a format string and a is a variable

Format String in c

The format string is enclosed within two double quotes “…….” The format string may contain:


input function :-scanf()

scanf is a function that reads formatted data from input stream, which is usually the keyboard,

Syntax of scanf() function

scanf(“format string” , list of variables);
Example:-
scanf(“%d”, x);