Login
Your Email
Pasword
Home
Write
Trending
History
Liked
Dashboard

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.

Do you have similar website/ Product?
Show in this page just for only $2 (for a month)
Create an Ad
0/60
0/180
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.
%dinteger
%ccharacter 
%ffloat
%ldlong integer
%ppointer
%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);
main()
{
   int a,b;
   int sum;
   printf("enter two values");
   scanf("%d %d",&a,&b);
   sum=a+b;
   printf("sum=%d",sum);
}
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.
CONTINUE READING
Formatted
unformatted
input
output
#C
functions
Programming
coding
learning
technology
Dalpat I
Content writer