CHAPTER OUTLINE
4.1 Introduction
4.2 Formatted Functions
A. p r i n t f () and s ca n f () Statements
B. Data Type and Conversion Symbol
C. Escape Sequences
4.3 Unformated Functions
A. Character I/O
B. String I/O
4.4 Commonly used Library Functions
Exercises
4.1 INTRODUCTION
Reading the data from the input devices and displaying the results on the screen, are the two main
tasks of any program. To perform these tasks user friendly C has a number of input and output
functions. When a program needs data, it takes the data through the input functions and sends
results obtained through the output functions. Thus, the input/output functions are the link between
the user and the terminal.
There are number of I/O functions in C based on the data types. The input/output functions are
classified in to two types 1) Formatted functions 2) Unformatted functions. Various functions of
these categories are listed in the Table 4.1.
a) Formatted functions The formatted input/output functions read and write all types of data
values. They require conversion symbol to identify the data type. Hence, they can be used for both
reading and writing of all data values. The formatted functions return the values after execution. The
return value is equal to the number of variables successfully read/written. Using this value the user
can find out the errors occurring during reading or writing the data.
b) Unform atted functions The unformatted input/output functions only work with the character
data type. They do not require conversion symbol for identification of data types because they work
only with character data type. There is no need to convert the data. In case values of other data types
are passed to these functions, they are treated as the character data. The unformatted functions also
return values, but the return value of unformatted function is always the same.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.227.10.45