Data Input and Output

50 %
50 %
Information about Data Input and Output

Published on March 15, 2014

Author: sabiksabz



This will help you to learn about Data Input and Output, especially for CSE students


INPUT/OUTPUT IN C  C has no built-in statements for input or output.  A library of functions is supplied to perform these operations. The I/O library functions are listed the “header” file <stdio.h>.  You do not need to memorize them, just be familiar with them.

STREAMS  All input and output is performed with streams.  A "stream" is a sequence of characters organized into lines.  Each line consists of zero or more characters and ends with the "newline" character.

TYPES OF STREAMS IN C  Standard input stream is called "stdin" and is normally connected to the keyboard  Standard output stream is called "stdout" and is normally connected to the display screen.  Standard error stream is called "stderr" and is also normally connected to the screen

I/O FUNCTIONS IN C  There are six i/o functions in C are:  1. getchar()  2. putchar()  3. printf()  4.scanf()  5.gets()  6.puts()

GETCHAR()  getchar();  Single character can be entered in computer using C.  Example:  Char c;  …………  …….  C=getchar();

PUTCHAR()  putchar();  It is used to display single char.  Example char c=‘H’; putchar(c);

SCANF scanf ( ) ;  This function provides for formatted input from the keyboard. The syntax is: scanf ( “format” , &var1, &var2, …) ;  The “format” is a listing of the data types of the variables to be input and the & in front of each variable name tells the system WHERE to store the value that is input. It provides the address for the variable.  Example: float a; int b; scanf (“%f%d”, &a, &b

FORMAT OF DATA  Format Conversion Specifiers: d -- displays a decimal (base 10) integer l -- used with other specifies to indicate a "long" e -- displays a floating point value in exponential notation f -- displays a floating point value g -- displays a number in either "e" or "f" format c -- displays a single character s -- displays a string of characters

STRINGS  When you enter string data the compiler automatically add 0 in the end of string;  Char name[22];  gets(name);  ‘ROHIT’  But actual value stored in computer is ‘ROHIT0’

PRINTF  This function provides for formatted output to the screen. The syntax is: printf ( “format”, var1, var2, … ) ;  The “format” includes a listing of the data types of the variables to be output and, optionally, some text and control character(s).  Example: float a ; int b ; scanf ( “%f%d”, &a, &b ) ; printf ( “You entered %f and %d n”, a, b ) ;

GETS AND PUTS  To input a string to computer  gets(name);  Puts is used to display string data on screen  puts(name);


THANK YOU With regards

Add a comment

Related presentations

Related pages

Input/output - Wikipedia, the free encyclopedia

Input/output This article does not cite any sources ... Inputs are the signals or data received by the system and outputs are the signals or data sent from it.
Read more

Data input and output - University of Texas at Austin

Structure of a C Up: Scientific programming in C Previous: Library functions Data input and output Data input and output operations in C are carried out by ...
Read more

Input and output data types - Communities | ArcGIS Resources

Input parameter data type Supported on ArcGIS Desktop clients? Supported on ArcGIS Explorer client? Supported on web application clients? Feature Set
Read more

Input-Output Tables - OECD

Date of release: December 2015. Input-Output Tables (IOTs) describe the sale and purchase relationships between producers and consumers within an economy.
Read more

MATLAB Input and Output - Hochschule Augsburg

MATLAB Input and Output Import and Export of data † Load data: load file [¡matj ¡ ascii] [variable:::] † Save data: save file [options] [variable:::]
Read more

BBC - GCSE Bitesize: Manual input devices

A secondary school revision resource for GCSE ICT looking at input devices, processing and output devices.
Read more

Data Input and Output in C, Part 1 - SitePoint – Learn ...

Surabhi Saxena continues our series on the foundation computer language C, this time looking at data input and output.
Read more

Data Input and Output

These modules provide tools for helping you read data into Azure Machine Learning Studio, and for saving your results to cloud data storage, including ...
Read more

Data Input and Output with Arduino - CodeProject

An example of how to interact with the user through the keypad, LCD and Buzzer; Author: José Cintra; Updated: 3 Jan 2016; Section: Boards ...
Read more