SlideShare a Scribd company logo
5
Most read
9
Most read
10
Most read
INPUT/OUTPUT
STATEMENTS
In C Language input and output function
are available as C compiler function or C
library provided with each C compiler
implementation. These all functions are
collectively known as Standard I/O
Library function. Here I/O stands for Input
and Output used for different inputting
and outputting statements.
Input Output Statements
 Input and Output statement are used to read
and write the data in C programming. These
are embedded in stdio.h (standard
Input/Output header file).
 There are mainly two of Input/Output functions
are used for this purpose. These are
discussed as:
a) Formatted I/O Functions
b) Unformatted I/O Functions
Formatted I/O Functions
 Formatted I/O functions which refers to an Input or
Ouput data that has been arranged in a particular
format. There are mainly two formatted I/O
functions discussed as follows:
a) scanf()
b) printf()
scanf()
 The scanf() function is an input function. It used to read the mixed
type of data from keyboard. You can read integer, float and
character data by using its control codes or format codes. The
general syntax is as:
scanf(“specifiers”, &variables);
printf()
 This ia an output function. It is used to
display a text message and to display the
mixed type (int, float, char) of data on screen.
The general syntax is as:
printf(“Your message”);
Escape Sequence
 When you’re programming in the C language,
sometimes you need to refer to a key press
that doesn’t result in a specific character.
Other times, you need to refer to a specific
character literally that normally has a different
meaning in C. In either case, you need an
escape sequence. The following table lists the
escape sequences you need to program in the
C language.
Lesson 7 io statements
Unformatted I/O functions
 There are mainly six unformatted I/O
functions discussed as follows:
a) getchar()
b) putchar()
c) gets()
d) puts()
e) getch()
f) getche()
getchar()
 This function is an Input function. It is used for reading
a single character from the keyboard.
 The general syntax is as:
 v = getchar();
where v is the variable of character type. For example:

putchar()
 This function is an output function. It is used
to display a single character on the screen.
The general syntax is as:
 putchar(v);
gets()
 This function is an input function. It is used
to read a string from the keyboard. The
general syntax is as:
 char n[20];
gets(n);
puts()
 This is an output function. It is used to
display a string inputted by gets() function.
The general syntax is as:
puts("text line");
getch()
 This is also an input function. This is used to
read a single character from the keyboard like
getchar() function. The general syntax is as:
v = getch();
getche()
 All are same as getch() function except it is
an echoed function. It means when you type
the character data from the keyboard it will
visible on the screen. The general syntax is as:
 v = getche();

More Related Content

PPT
Operators in C Programming
PPTX
Inheritance in java
PPTX
Introduction to Basics of Python
PPTX
Presentation on python
PPTX
Input and Output In C Language
PPTX
Steps for c program execution
PPTX
Operators in Python
PPTX
C introduction by thooyavan
Operators in C Programming
Inheritance in java
Introduction to Basics of Python
Presentation on python
Input and Output In C Language
Steps for c program execution
Operators in Python
C introduction by thooyavan

What's hot (20)

PPTX
Recursive Function
PPTX
C programming interview questions
PPTX
Python - An Introduction
PPT
pre processor directives in C
PPTX
USER DEFINE FUNCTIONS IN PYTHON
PPT
Operators in c language
PPTX
Expression and Operartor In C Programming
PPTX
Algorithm and flowchart
DOC
Notes of c programming 1st unit BCA I SEM
PPTX
Operator.ppt
PPTX
C and its errors
PPTX
Header files of c++ unit 3 -topic 3
PDF
Object oriented programming c++
PPT
Variables in C Programming
PPT
Array in c
PPTX
Python Functions
PPTX
Introduction of c programming
PDF
Html notes
PPTX
Scope rules : local and global variables
PPTX
Looping statements in C
Recursive Function
C programming interview questions
Python - An Introduction
pre processor directives in C
USER DEFINE FUNCTIONS IN PYTHON
Operators in c language
Expression and Operartor In C Programming
Algorithm and flowchart
Notes of c programming 1st unit BCA I SEM
Operator.ppt
C and its errors
Header files of c++ unit 3 -topic 3
Object oriented programming c++
Variables in C Programming
Array in c
Python Functions
Introduction of c programming
Html notes
Scope rules : local and global variables
Looping statements in C
Ad

Similar to Lesson 7 io statements (20)

PPT
input/output function presentation.pptx.
PPTX
Input Output function in c programing language.pptx
PPTX
COM1407: Input/ Output Functions
PDF
Managing I/O operations In C- Language
PPTX
20220823094225_PPT02-Formatted Input and Output.pptx
DOCX
UNIT-II CP DOC.docx
PPTX
Managing input and output operation in c
PPTX
Functions of stdio conio
PPTX
Data Input and Output
PPTX
Chap 2 input output dti2143
PPT
CPU INPUT OUTPUT
PPTX
C language
PPTX
Managing input and output operations in c
PPTX
C preprocesor
PPTX
Presentation1.pptx pic assignment for enginerring
PDF
Introduction to Input/Output Functions in C
PPTX
Unit 3. Input and Output
PDF
Input and output in c language c programming
PPTX
Introduction to C Unit 1
PPTX
c program presentation on format specifer.pptx
input/output function presentation.pptx.
Input Output function in c programing language.pptx
COM1407: Input/ Output Functions
Managing I/O operations In C- Language
20220823094225_PPT02-Formatted Input and Output.pptx
UNIT-II CP DOC.docx
Managing input and output operation in c
Functions of stdio conio
Data Input and Output
Chap 2 input output dti2143
CPU INPUT OUTPUT
C language
Managing input and output operations in c
C preprocesor
Presentation1.pptx pic assignment for enginerring
Introduction to Input/Output Functions in C
Unit 3. Input and Output
Input and output in c language c programming
Introduction to C Unit 1
c program presentation on format specifer.pptx
Ad

More from Dr. Rupinder Singh (8)

PPTX
1.1 communication
PPTX
PPT
PPTX
PPTX
PPTX
Data types
PPTX
Compilation
PPTX

Recently uploaded (20)

PPTX
Lesson notes of climatology university.
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PDF
Anesthesia in Laparoscopic Surgery in India
PDF
Computing-Curriculum for Schools in Ghana
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PDF
Classroom Observation Tools for Teachers
PDF
RMMM.pdf make it easy to upload and study
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PPTX
Cell Structure & Organelles in detailed.
PPTX
Cell Types and Its function , kingdom of life
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PDF
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
PPTX
Pharma ospi slides which help in ospi learning
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
Lesson notes of climatology university.
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
Anesthesia in Laparoscopic Surgery in India
Computing-Curriculum for Schools in Ghana
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
Classroom Observation Tools for Teachers
RMMM.pdf make it easy to upload and study
Pharmacology of Heart Failure /Pharmacotherapy of CHF
Cell Structure & Organelles in detailed.
Cell Types and Its function , kingdom of life
FourierSeries-QuestionsWithAnswers(Part-A).pdf
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
Abdominal Access Techniques with Prof. Dr. R K Mishra
2.FourierTransform-ShortQuestionswithAnswers.pdf
Final Presentation General Medicine 03-08-2024.pptx
102 student loan defaulters named and shamed – Is someone you know on the list?
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
Pharma ospi slides which help in ospi learning
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...

Lesson 7 io statements

  • 1. INPUT/OUTPUT STATEMENTS In C Language input and output function are available as C compiler function or C library provided with each C compiler implementation. These all functions are collectively known as Standard I/O Library function. Here I/O stands for Input and Output used for different inputting and outputting statements.
  • 2. Input Output Statements  Input and Output statement are used to read and write the data in C programming. These are embedded in stdio.h (standard Input/Output header file).  There are mainly two of Input/Output functions are used for this purpose. These are discussed as: a) Formatted I/O Functions b) Unformatted I/O Functions
  • 3. Formatted I/O Functions  Formatted I/O functions which refers to an Input or Ouput data that has been arranged in a particular format. There are mainly two formatted I/O functions discussed as follows: a) scanf() b) printf()
  • 4. scanf()  The scanf() function is an input function. It used to read the mixed type of data from keyboard. You can read integer, float and character data by using its control codes or format codes. The general syntax is as: scanf(“specifiers”, &variables);
  • 5. printf()  This ia an output function. It is used to display a text message and to display the mixed type (int, float, char) of data on screen. The general syntax is as: printf(“Your message”);
  • 6. Escape Sequence  When you’re programming in the C language, sometimes you need to refer to a key press that doesn’t result in a specific character. Other times, you need to refer to a specific character literally that normally has a different meaning in C. In either case, you need an escape sequence. The following table lists the escape sequences you need to program in the C language.
  • 8. Unformatted I/O functions  There are mainly six unformatted I/O functions discussed as follows: a) getchar() b) putchar() c) gets() d) puts() e) getch() f) getche()
  • 9. getchar()  This function is an Input function. It is used for reading a single character from the keyboard.  The general syntax is as:  v = getchar(); where v is the variable of character type. For example: 
  • 10. putchar()  This function is an output function. It is used to display a single character on the screen. The general syntax is as:  putchar(v);
  • 11. gets()  This function is an input function. It is used to read a string from the keyboard. The general syntax is as:  char n[20]; gets(n);
  • 12. puts()  This is an output function. It is used to display a string inputted by gets() function. The general syntax is as: puts("text line");
  • 13. getch()  This is also an input function. This is used to read a single character from the keyboard like getchar() function. The general syntax is as: v = getch();
  • 14. getche()  All are same as getch() function except it is an echoed function. It means when you type the character data from the keyboard it will visible on the screen. The general syntax is as:  v = getche();