SlideShare a Scribd company logo
Managing input and output operation in c
1. Introduction
2. Header Files
3. Unformatted input
function
4. Formatted input function
5. Unformatted output
function
6. Formatted output
function
Usually higher-level programs
language like C,java,etc..does
not have any build-in
Input/Output statement as
part of syntax.
Therefore we use to file
which has Input/Output
function.
Thus, we make header file
which I/O function when it
required.
The value assigned for first time
to any variable is called
initialization.
When we want to use library
functions, it is required to include
respective library in the program.
The value assigned for first
time to any variable is called
initialization.
When we want to use library
functions, it is required to
include respective library in the
program.
C is functional languages, so
for accepting input and
printing output. There must
provides readymade functions.
Maximum input and output
are define in header files
name in C is stdio.h .
Stdio.h (standard input-
output header file) included
function like
get(c),getchar(),gets(),printf()
,put(c),putchar,puts(),scanf(),
etc.
Other header files were
1. <ctype.h> :- Character
testing and conversion
function
2. <math.h> :-Mathematical
function
3. <string.h> :-String
manipulation
Getchar() function
 It is used to accept a
character in a C program.
Its standard form is
Syntax :
variable_name =getchar();
Getchar() function
When getchar() function will be
encountered by C compiler while
executing a program , the
program will wait for the user to
press a key from the keyboard.
The character keyword in from
the keyword will be enclose on
the screen.
Getche() function
This function is used to take
a character from consol.
It is included in conio.h
Header file.
Getch() function
This function is used for
inputting a character from the
keyboard but the character
keyed in will not be enclosed
on the screen. i.e. the
character is invisible on the
screen.
It is included in stdio.h
Header file.
Getc() function
This function is used to
accept the character from
the file.
It is included in stdio.h
Header file.
Gets() function
This function is used to read
a string from the keyboard if
input device is not specified.
Syntax :
gets(variable_name);
E.g. char str1[50]
gets(str1);
Gets() function
When gets() function is
encountered by C compiler, it will
wait for the user to enter sequence
of character from the input device.
The wait gets automatically
terminated when an Enter key is
press.
A null character(‘0’) is
automatically assigned as a last
character of the string by the
compiler immediately after the Enter
key.
When formatted input is required :
1. When we need to input numerical
data which may required in
calculations.
2. When enter key itself is a part of
the data.
3. When we need to input data in a
particular format.
 The scanf() function is used to input
data in a formatted manner.
Scanf() Function
 The scanf() function is used to input
data in a formatted manner.
 Syntax :
 scanf(“control string”,&var1,&var2
,……………,&varn);
 In C, to represent an address of any
location , an ampersand(&) is used.
 Control string specifies the format
in which the values of variables are
to be stored.
 Each format must be preceded by %
sign .
Data Type Corresponding Character
For inputting a decimal integer %d OR %i
For inputting an unsigned positive integer %u
For inputting a character %c
For inputting a string %s
For inputting a real value without exponent form %f
For inputting a short integer %h
For inputting a long integer %ld
For inputting a double value %lf
For inputting a long double value %Lf
 C provides inbuilt function in
library stdio.h know as
printf().
 Other for them some
function name putchar() ,
putc() , puts() functions give
the output as it stored in
variable.
Putchar() Function
 The function putchar() writes a
single character , one at a time
to the standard output device.
 Syntax :
putchar(variable_name);
 When this statement is
executed , the stored character
will be displayed on the
monitor.
Putc() Function
 The function putc() send a
character to give file
instead of the standard
output device.
 Syntax :
putc(word,file);
Puts() Function
 The function puts() to write a
string to output device.
 Syntax :
puts(variable_name);
 Every string contains a null
character but puts() will not
display this character .
 C provides inbuilt function in
library stdio.h know as printf().
 Syntax :
printf(“control string” , var1 ,var2
,……,varn);
 The control string entries are
usually separated by space and
preceded by %.
Printf() Function
 The control string contains two
types object.
1. A set of characters , which will
be display on the monitor as
they come in view.
2. The format specification for
each variable in order in which
they appear.
Data Type Corresponding Character
For printing a decimal integer %d
For printing a long decimal integer %ld
For printing a signed decimal integer %i
For printing an unsigned positive integer %u
For printing an integer in octal form %o
For printing an integer in hexadecimal form %x
For printing a character %c
For printing a string %s
For printing a real value without exponent form %f
For printing a real value in exponent form %e
For printing a double value %lf
For printing a long double value %Lf

More Related Content

What's hot (20)

PPTX
Type casting in java
Farooq Baloch
 
PPT
Input and output in C++
Nilesh Dalvi
 
PPT
RECURSION IN C
v_jk
 
PPTX
C functions
University of Potsdam
 
PPTX
Decision Making Statement in C ppt
MANJUTRIPATHI7
 
DOC
Jumping statements
Suneel Dogra
 
PPTX
Programming in C Presentation upto FILE
Dipta Saha
 
PPTX
Strings in c++
Neeru Mittal
 
PPTX
Printf and scanf
gidc engineering college
 
PPTX
Functions in C
Kamal Acharya
 
PPT
Strings Functions in C Programming
DevoAjit Gupta
 
PPTX
Control structures in java
VINOTH R
 
PPTX
Constants, Variables, and Data Types
Rokonuzzaman Rony
 
PPTX
Functions in c
sunila tharagaturi
 
PPTX
String In C Language
Simplilearn
 
PPT
Basics of c++
Huba Akhtar
 
PPTX
Functions in C.pptx
Ashwini Raut
 
PPTX
File in C language
Manash Kumar Mondal
 
Type casting in java
Farooq Baloch
 
Input and output in C++
Nilesh Dalvi
 
RECURSION IN C
v_jk
 
Decision Making Statement in C ppt
MANJUTRIPATHI7
 
Jumping statements
Suneel Dogra
 
Programming in C Presentation upto FILE
Dipta Saha
 
Strings in c++
Neeru Mittal
 
Printf and scanf
gidc engineering college
 
Functions in C
Kamal Acharya
 
Strings Functions in C Programming
DevoAjit Gupta
 
Control structures in java
VINOTH R
 
Constants, Variables, and Data Types
Rokonuzzaman Rony
 
Functions in c
sunila tharagaturi
 
String In C Language
Simplilearn
 
Basics of c++
Huba Akhtar
 
Functions in C.pptx
Ashwini Raut
 
File in C language
Manash Kumar Mondal
 

Viewers also liked (20)

PPTX
Input Output Management In C Programming
Kamal Acharya
 
PPT
Mesics lecture 5 input – output in ‘c’
eShikshak
 
PPTX
Basic Input and Output
Nurul Zakiah Zamri Tan
 
PDF
Input and output in c
Rachana Joshi
 
PPTX
Managing console
Shiva Saxena
 
PPT
Formatted input and output
Online
 
PPTX
C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and...
yazad dumasia
 
PDF
Programming embedded system_ii_keil_8051(1)
Fendie Mimpi
 
PDF
Automotive Circuit Boards
Art Wood
 
PPT
C presentation book
krunal1210
 
PDF
RoHS Compliant Lead Free PCB Fabrication
Art Wood
 
PDF
SMT machine Training Manual for FUJI CP6 Series Level 3
Shenzhen Southern Machinery Sales And Service Co., Ltd
 
PPT
Pcb Production and Prototype Manufacturing Capabilities for Saturn Electronic...
Art Wood
 
DOC
Reflow oven
Sathish Ganesan
 
PPSX
training_presentation
Aniket Pawar
 
PDF
Epoxy flux a low cost high reliability approach for pop assembly-imaps 2011
nclee715
 
PDF
New Algorithms to Improve X-Ray Inspection
Bill Cardoso
 
PPT
C chap02
Kamran
 
PPT
File handling-dutt
Anil Dutt
 
Input Output Management In C Programming
Kamal Acharya
 
Mesics lecture 5 input – output in ‘c’
eShikshak
 
Basic Input and Output
Nurul Zakiah Zamri Tan
 
Input and output in c
Rachana Joshi
 
Managing console
Shiva Saxena
 
Formatted input and output
Online
 
C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and...
yazad dumasia
 
Programming embedded system_ii_keil_8051(1)
Fendie Mimpi
 
Automotive Circuit Boards
Art Wood
 
C presentation book
krunal1210
 
RoHS Compliant Lead Free PCB Fabrication
Art Wood
 
SMT machine Training Manual for FUJI CP6 Series Level 3
Shenzhen Southern Machinery Sales And Service Co., Ltd
 
Pcb Production and Prototype Manufacturing Capabilities for Saturn Electronic...
Art Wood
 
Reflow oven
Sathish Ganesan
 
training_presentation
Aniket Pawar
 
Epoxy flux a low cost high reliability approach for pop assembly-imaps 2011
nclee715
 
New Algorithms to Improve X-Ray Inspection
Bill Cardoso
 
C chap02
Kamran
 
File handling-dutt
Anil Dutt
 
Ad

Similar to Managing input and output operation in c (20)

PPTX
COM1407: Input/ Output Functions
Hemantha Kulathilake
 
PPTX
20220823094225_PPT02-Formatted Input and Output.pptx
putrielisabeth3
 
DOCX
UNIT-II CP DOC.docx
JavvajiVenkat
 
PPT
CPU INPUT OUTPUT
Aditya Vaishampayan
 
PPTX
Input and Output In C Language
Adnan Khan
 
PPTX
Input Output function in c programing language.pptx
amit0815q
 
PPTX
Functions of stdio conio
Bhavik Vashi
 
PPTX
C language
TaranjeetKaur72
 
PPTX
Data Input and Output
Sabik T S
 
PPTX
Introduction to C Unit 1
Dr. SURBHI SAROHA
 
PPT
(Lect. 2 & 3) Introduction to C.ppt
atulchaudhary821
 
PPTX
C programming(part 3)
Dr. SURBHI SAROHA
 
PPT
Lecture 8- Data Input and Output
Md. Imran Hossain Showrov
 
PDF
3_Input_output.pdf this is about orogramminy
sumiyaahmedachol
 
PDF
Module 1_Chapter 2_PPT (1)sasaddsdsds.pdf
anilcsbs
 
PPTX
Unit 3. Input and Output
Ashim Lamichhane
 
PPT
Fundamental of C Programming Language and Basic Input/Output Function
imtiazalijoono
 
PPTX
Unit 2 CMath behind coding.pptx
PragatheshP
 
PPTX
Managing I/O & String function in C
Abinaya B
 
PPTX
Chap 2 input output dti2143
alish sha
 
COM1407: Input/ Output Functions
Hemantha Kulathilake
 
20220823094225_PPT02-Formatted Input and Output.pptx
putrielisabeth3
 
UNIT-II CP DOC.docx
JavvajiVenkat
 
CPU INPUT OUTPUT
Aditya Vaishampayan
 
Input and Output In C Language
Adnan Khan
 
Input Output function in c programing language.pptx
amit0815q
 
Functions of stdio conio
Bhavik Vashi
 
C language
TaranjeetKaur72
 
Data Input and Output
Sabik T S
 
Introduction to C Unit 1
Dr. SURBHI SAROHA
 
(Lect. 2 & 3) Introduction to C.ppt
atulchaudhary821
 
C programming(part 3)
Dr. SURBHI SAROHA
 
Lecture 8- Data Input and Output
Md. Imran Hossain Showrov
 
3_Input_output.pdf this is about orogramminy
sumiyaahmedachol
 
Module 1_Chapter 2_PPT (1)sasaddsdsds.pdf
anilcsbs
 
Unit 3. Input and Output
Ashim Lamichhane
 
Fundamental of C Programming Language and Basic Input/Output Function
imtiazalijoono
 
Unit 2 CMath behind coding.pptx
PragatheshP
 
Managing I/O & String function in C
Abinaya B
 
Chap 2 input output dti2143
alish sha
 
Ad

More from yazad dumasia (7)

PPTX
Introduction to Pylab and Matploitlib.
yazad dumasia
 
PPTX
Schemas for multidimensional databases
yazad dumasia
 
PPTX
Classification decision tree
yazad dumasia
 
PPTX
Basic economic problem: Inflation
yazad dumasia
 
PPTX
Groundwater contamination
yazad dumasia
 
PPTX
Merge sort analysis and its real time applications
yazad dumasia
 
PPTX
Cyber crime
yazad dumasia
 
Introduction to Pylab and Matploitlib.
yazad dumasia
 
Schemas for multidimensional databases
yazad dumasia
 
Classification decision tree
yazad dumasia
 
Basic economic problem: Inflation
yazad dumasia
 
Groundwater contamination
yazad dumasia
 
Merge sort analysis and its real time applications
yazad dumasia
 
Cyber crime
yazad dumasia
 

Recently uploaded (20)

PPTX
Knowledge Representation : Semantic Networks
Amity University, Patna
 
PPTX
Damage of stability of a ship and how its change .pptx
ehamadulhaque
 
PDF
International Journal of Information Technology Convergence and services (IJI...
ijitcsjournal4
 
PPTX
Introduction to Design of Machine Elements
PradeepKumarS27
 
PPTX
Mechanical Design of shell and tube heat exchangers as per ASME Sec VIII Divi...
shahveer210504
 
PDF
AI TECHNIQUES FOR IDENTIFYING ALTERATIONS IN THE HUMAN GUT MICROBIOME IN MULT...
vidyalalltv1
 
PPTX
Arduino Based Gas Leakage Detector Project
CircuitDigest
 
PDF
Halide Perovskites’ Multifunctional Properties: Coordination Engineering, Coo...
TaameBerhe2
 
PDF
Viol_Alessandro_Presentazione_prelaurea.pdf
dsecqyvhbowrzxshhf
 
PPTX
265587293-NFPA 101 Life safety code-PPT-1.pptx
chandermwason
 
PDF
Design Thinking basics for Engineers.pdf
CMR University
 
PPTX
GitOps_Without_K8s_Training_detailed git repository
DanialHabibi2
 
PPT
PPT2_Metal formingMECHANICALENGINEEIRNG .ppt
Praveen Kumar
 
PPTX
MATLAB : Introduction , Features , Display Windows, Syntax, Operators, Graph...
Amity University, Patna
 
PPTX
美国电子版毕业证南卡罗莱纳大学上州分校水印成绩单USC学费发票定做学位证书编号怎么查
Taqyea
 
DOC
MRRS Strength and Durability of Concrete
CivilMythili
 
PDF
MAD Unit - 2 Activity and Fragment Management in Android (Diploma IT)
JappanMavani
 
PPT
Carmon_Remote Sensing GIS by Mahesh kumar
DhananjayM6
 
PDF
Zilliz Cloud Demo for performance and scale
Zilliz
 
PPTX
2025 CGI Congres - Surviving agile v05.pptx
Derk-Jan de Grood
 
Knowledge Representation : Semantic Networks
Amity University, Patna
 
Damage of stability of a ship and how its change .pptx
ehamadulhaque
 
International Journal of Information Technology Convergence and services (IJI...
ijitcsjournal4
 
Introduction to Design of Machine Elements
PradeepKumarS27
 
Mechanical Design of shell and tube heat exchangers as per ASME Sec VIII Divi...
shahveer210504
 
AI TECHNIQUES FOR IDENTIFYING ALTERATIONS IN THE HUMAN GUT MICROBIOME IN MULT...
vidyalalltv1
 
Arduino Based Gas Leakage Detector Project
CircuitDigest
 
Halide Perovskites’ Multifunctional Properties: Coordination Engineering, Coo...
TaameBerhe2
 
Viol_Alessandro_Presentazione_prelaurea.pdf
dsecqyvhbowrzxshhf
 
265587293-NFPA 101 Life safety code-PPT-1.pptx
chandermwason
 
Design Thinking basics for Engineers.pdf
CMR University
 
GitOps_Without_K8s_Training_detailed git repository
DanialHabibi2
 
PPT2_Metal formingMECHANICALENGINEEIRNG .ppt
Praveen Kumar
 
MATLAB : Introduction , Features , Display Windows, Syntax, Operators, Graph...
Amity University, Patna
 
美国电子版毕业证南卡罗莱纳大学上州分校水印成绩单USC学费发票定做学位证书编号怎么查
Taqyea
 
MRRS Strength and Durability of Concrete
CivilMythili
 
MAD Unit - 2 Activity and Fragment Management in Android (Diploma IT)
JappanMavani
 
Carmon_Remote Sensing GIS by Mahesh kumar
DhananjayM6
 
Zilliz Cloud Demo for performance and scale
Zilliz
 
2025 CGI Congres - Surviving agile v05.pptx
Derk-Jan de Grood
 

Managing input and output operation in c

  • 2. 1. Introduction 2. Header Files 3. Unformatted input function 4. Formatted input function 5. Unformatted output function 6. Formatted output function
  • 3. Usually higher-level programs language like C,java,etc..does not have any build-in Input/Output statement as part of syntax. Therefore we use to file which has Input/Output function.
  • 4. Thus, we make header file which I/O function when it required. The value assigned for first time to any variable is called initialization. When we want to use library functions, it is required to include respective library in the program.
  • 5. The value assigned for first time to any variable is called initialization. When we want to use library functions, it is required to include respective library in the program.
  • 6. C is functional languages, so for accepting input and printing output. There must provides readymade functions. Maximum input and output are define in header files name in C is stdio.h .
  • 7. Stdio.h (standard input- output header file) included function like get(c),getchar(),gets(),printf() ,put(c),putchar,puts(),scanf(), etc.
  • 8. Other header files were 1. <ctype.h> :- Character testing and conversion function 2. <math.h> :-Mathematical function 3. <string.h> :-String manipulation
  • 9. Getchar() function  It is used to accept a character in a C program. Its standard form is Syntax : variable_name =getchar();
  • 10. Getchar() function When getchar() function will be encountered by C compiler while executing a program , the program will wait for the user to press a key from the keyboard. The character keyword in from the keyword will be enclose on the screen.
  • 11. Getche() function This function is used to take a character from consol. It is included in conio.h Header file.
  • 12. Getch() function This function is used for inputting a character from the keyboard but the character keyed in will not be enclosed on the screen. i.e. the character is invisible on the screen. It is included in stdio.h Header file.
  • 13. Getc() function This function is used to accept the character from the file. It is included in stdio.h Header file.
  • 14. Gets() function This function is used to read a string from the keyboard if input device is not specified. Syntax : gets(variable_name); E.g. char str1[50] gets(str1);
  • 15. Gets() function When gets() function is encountered by C compiler, it will wait for the user to enter sequence of character from the input device. The wait gets automatically terminated when an Enter key is press. A null character(‘0’) is automatically assigned as a last character of the string by the compiler immediately after the Enter key.
  • 16. When formatted input is required : 1. When we need to input numerical data which may required in calculations. 2. When enter key itself is a part of the data. 3. When we need to input data in a particular format.  The scanf() function is used to input data in a formatted manner.
  • 17. Scanf() Function  The scanf() function is used to input data in a formatted manner.  Syntax :  scanf(“control string”,&var1,&var2 ,……………,&varn);  In C, to represent an address of any location , an ampersand(&) is used.  Control string specifies the format in which the values of variables are to be stored.  Each format must be preceded by % sign .
  • 18. Data Type Corresponding Character For inputting a decimal integer %d OR %i For inputting an unsigned positive integer %u For inputting a character %c For inputting a string %s For inputting a real value without exponent form %f For inputting a short integer %h For inputting a long integer %ld For inputting a double value %lf For inputting a long double value %Lf
  • 19.  C provides inbuilt function in library stdio.h know as printf().  Other for them some function name putchar() , putc() , puts() functions give the output as it stored in variable.
  • 20. Putchar() Function  The function putchar() writes a single character , one at a time to the standard output device.  Syntax : putchar(variable_name);  When this statement is executed , the stored character will be displayed on the monitor.
  • 21. Putc() Function  The function putc() send a character to give file instead of the standard output device.  Syntax : putc(word,file);
  • 22. Puts() Function  The function puts() to write a string to output device.  Syntax : puts(variable_name);  Every string contains a null character but puts() will not display this character .
  • 23.  C provides inbuilt function in library stdio.h know as printf().  Syntax : printf(“control string” , var1 ,var2 ,……,varn);  The control string entries are usually separated by space and preceded by %.
  • 24. Printf() Function  The control string contains two types object. 1. A set of characters , which will be display on the monitor as they come in view. 2. The format specification for each variable in order in which they appear.
  • 25. Data Type Corresponding Character For printing a decimal integer %d For printing a long decimal integer %ld For printing a signed decimal integer %i For printing an unsigned positive integer %u For printing an integer in octal form %o For printing an integer in hexadecimal form %x For printing a character %c For printing a string %s For printing a real value without exponent form %f For printing a real value in exponent form %e For printing a double value %lf For printing a long double value %Lf