Data Input Output Overview

In C, input/output (I /O) operations are accomplished through library functions. An I/O function can be accessed from anywhere within a program simply by writing the function name, followed by a list of arguments enclosed in parentheses. The arguments represent data items that are sent to the function. Some I/O functions do not require arguments, though the empty parentheses must still appear. There are numerous library functions available for I/O. these can classified into two broad categories:

  • • Console I/O function – Console I/O functions are used to receive input from keyboard and write output to the monitor.
  • • File I/O functions – File I/O functions are used to perform I/O operations on a floppy disk or hard disk.

In this Chapter we would be discussing only Console I/O functions. Console I/O functions can be further classified into two categories – formatted and unformatted console I/O functions. The basic difference between them is that the formatted functions allow the input read from the keyboard or the output displayed on the monitor to be formatted as per requirements.


It should be noted that, although the following pertains to input from the keyboard and output to the screen, the actual source and target of C’s I/O functions are the standard input and standard input of the system, which means that this input and output may be re-directed to other devices.

Each program that uses a standard input/output function must contain the statement

#include <stdio.h>

at the beginning. However, there might be exceptions. For example, this is not necessary for the functions printf and scanf which have been defined as a part of the C language. The file name stdio.h is an abbreviation for standard input – output header file. The instruction #include <stdio.h> tells the compiler to search for a file named stdio.h and place its contents at this point in the program. The contents of the header file become part of the source code when it is complied. Table shows standard input output library functions.

img

About the Author



Silan Software is one of the India's leading provider of offline & online training for Java, Python, AI (Machine Learning, Deep Learning), Data Science, Software Development & many more emerging Technologies.

We provide Academic Training || Industrial Training || Corporate Training || Internship || Java || Python || AI using Python || Data Science etc





 PreviousNext