Skip to main content Accessibility help
Internet Explorer 11 is being discontinued by Microsoft in August 2021. If you have difficulties viewing the site on Internet Explorer 11 we recommend using a different browser such as Microsoft Edge, Google Chrome, Apple Safari or Mozilla Firefox.

Chapter 8: Input and Output Statement

Chapter 8: Input and Output Statement

pp. 98-131

Authors

, Techno India Hooghly, West Bengal, , Techno India College of Technology, West Bengal
  • Add bookmark
  • Cite
  • Share

Extract

In the previous chapters we have learnt how variables can be declared and initialized, what are the different operators available in C and using these operators how a meaningful expression can be written. Now, we will discuss how the input and output operations are carried out in C.

C language does not have any input or output statement. All the input and output operations are accomplished using some library functions. These are included in stdio.h and conio.h header files. These input and output functions or in short, I/O functions are categorized into three groups. These are:

  • 1. Console I/O functions which deal with keyboard and monitor,

  • 2. Disk I/O functions which deal with hard disk or floppy disk and

  • 3. Port I/O functions which deal with different port.

In this chapter, we will discuss only about some console I/O functions that are used frequently. These console I/O functions can be categorized into formatted I/O functions and unformatted I/O functions.

FORMATTED I/O FUNCTIONS

Formatted input refers to read or input data using keyboard in a particular format and formatted output refers to print or display (i.e., output) data or message in the VDU in a formatted way means when a set of values will be displayed, the sequence of the fields, their widths, spaces among the values, etc. can be specified. The standard library function scanf( ) is used for formatted input operation and printf( ) is used for formatted output operation.

About the book

Access options

Review the options below to login to check your access.

Purchase options

Paperback
US$105.00

Have an access code?

To redeem an access code, please log in with your personal login.

If you believe you should have access to this content, please contact your institutional librarian or consult our FAQ page for further information about accessing our content.

Also available to purchase from these educational ebook suppliers