Enter your email id to get regular update free
Your Email

formatted input functions explanation - Programming in #C (module-17)

In this section we will discuss on the input and output functions. Unformatted and formatted input and output functions of #C.

This is the 17th module on learning C with us. Earlier we discussed on the basic introduction and structure of C, preprocessor it's features, intermediate and executable codes. compilation and execution process of a C program. And keywords and identifiers, data types, variables and constants, scope of variables, operators and expressions in C. Type casting in #C. Introduction to input and output functions and reading a character in #C. 
In this section we will discuss on the input and output functions. Formatted input and output functions of #C.
For unformatted input functions you may refer to module 16 here ūüĎé :
Unformatted input functions 
Formatted input functions :-
printf() and scanf() are example of formatted input functions. In formatted input functions we specify the type / format of the data we read/display.
printf() is an example of formatted output function and scanf() is an example of formatted input function.

printf() and scanf() with format specifier :-
Formatted input refers to an input  data that has been arranged in a particular format for that we have scanf.
scanf("control string",arg1,arg2.....argn)
Control string specifies field format in which data is to be entered.
%ldlong integer
%uunsigned integer

arg1,arg2.......argn specifies address of loactions or variables where data is stored.
Eg. scanf("%d %d %d",&a,&b);
For formatted output we use printf as :
printf("control string",arg1,arg2.....argn)
Eg. printf("%d %d",&a,&b);
   int a,b;
   int sum;
   printf("enter two values");
   scanf("%d %d",&a,&b);
In next module we will continue our discussions on the most important topic that is control statements. For more information regarding #C please be updated with us only on Www.newsandstory.com as we provide all the information on all the topics covered in #C.
Dalpat I
Content writer
Total 49 views