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
Ad

More Related Content

What's hot (20)

Functions in c++
Functions in c++Functions in c++
Functions in c++
Rokonuzzaman Rony
 
Files in c++
Files in c++Files in c++
Files in c++
Selvin Josy Bai Somu
 
Control statements in c
Control statements in cControl statements in c
Control statements in c
Sathish Narayanan
 
C functions
C functionsC functions
C functions
University of Potsdam
 
Structure of C++ - R.D.Sivakumar
Structure of C++ - R.D.SivakumarStructure of C++ - R.D.Sivakumar
Structure of C++ - R.D.Sivakumar
Sivakumar R D .
 
Class and object in C++
Class and object in C++Class and object in C++
Class and object in C++
rprajat007
 
Strings
StringsStrings
Strings
Mitali Chugh
 
User defined functions in C
User defined functions in CUser defined functions in C
User defined functions in C
Harendra Singh
 
RECURSION IN C
RECURSION IN C RECURSION IN C
RECURSION IN C
v_jk
 
User defined functions in C programmig
User defined functions in C programmigUser defined functions in C programmig
User defined functions in C programmig
Appili Vamsi Krishna
 
Character Array and String
Character Array and StringCharacter Array and String
Character Array and String
Tasnima Hamid
 
C lecture 4 nested loops and jumping statements slideshare
C lecture 4 nested loops and jumping statements slideshareC lecture 4 nested loops and jumping statements slideshare
C lecture 4 nested loops and jumping statements slideshare
Gagan Deep
 
C decision making and looping.
C decision making and looping.C decision making and looping.
C decision making and looping.
Haard Shah
 
C++ presentation
C++ presentationC++ presentation
C++ presentation
SudhanshuVijay3
 
Sets in python
Sets in pythonSets in python
Sets in python
baabtra.com - No. 1 supplier of quality freshers
 
Unit ii chapter 2 Decision making and Branching in C
Unit ii chapter 2 Decision making and Branching in CUnit ii chapter 2 Decision making and Branching in C
Unit ii chapter 2 Decision making and Branching in C
Sowmya Jyothi
 
Function in c
Function in cFunction in c
Function in c
Raj Tandukar
 
Operator Overloading
Operator OverloadingOperator Overloading
Operator Overloading
Nilesh Dalvi
 
Function in c program
Function in c programFunction in c program
Function in c program
umesh patil
 
Presentation on function
Presentation on functionPresentation on function
Presentation on function
Abu Zaman
 

Viewers also liked (20)

Input Output Management In C Programming
Input Output Management In C ProgrammingInput Output Management In C Programming
Input Output Management In C Programming
Kamal Acharya
 
Mesics lecture 5 input – output in ‘c’
Mesics lecture 5   input – output in ‘c’Mesics lecture 5   input – output in ‘c’
Mesics lecture 5 input – output in ‘c’
eShikshak
 
Basic Input and Output
Basic Input and OutputBasic Input and Output
Basic Input and Output
Nurul Zakiah Zamri Tan
 
Input and output in c
Input and output in cInput and output in c
Input and output in c
Rachana Joshi
 
Managing console
Managing consoleManaging console
Managing console
Shiva Saxena
 
Formatted input and output
Formatted input and outputFormatted input and output
Formatted input and output
Online
 
C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and...
C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and...C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and...
C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and...
yazad dumasia
 
Programming embedded system_ii_keil_8051(1)
Programming embedded system_ii_keil_8051(1)Programming embedded system_ii_keil_8051(1)
Programming embedded system_ii_keil_8051(1)
Fendie Mimpi
 
Automotive Circuit Boards
Automotive Circuit BoardsAutomotive Circuit Boards
Automotive Circuit Boards
Art Wood
 
C presentation book
C presentation bookC presentation book
C presentation book
krunal1210
 
RoHS Compliant Lead Free PCB Fabrication
RoHS Compliant Lead Free PCB FabricationRoHS Compliant Lead Free PCB Fabrication
RoHS Compliant Lead Free PCB Fabrication
Art Wood
 
SMT machine Training Manual for FUJI CP6 Series Level 3
SMT machine Training Manual for FUJI  CP6 Series Level 3SMT machine Training Manual for FUJI  CP6 Series Level 3
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...
Pcb Production and Prototype Manufacturing Capabilities for Saturn Electronic...Pcb Production and Prototype Manufacturing Capabilities for Saturn Electronic...
Pcb Production and Prototype Manufacturing Capabilities for Saturn Electronic...
Art Wood
 
Reflow oven
Reflow ovenReflow oven
Reflow oven
Sathish Ganesan
 
training_presentation
training_presentationtraining_presentation
training_presentation
Aniket Pawar
 
Epoxy flux a low cost high reliability approach for pop assembly-imaps 2011
Epoxy flux  a low cost high reliability approach for pop assembly-imaps 2011Epoxy flux  a low cost high reliability approach for pop assembly-imaps 2011
Epoxy flux a low cost high reliability approach for pop assembly-imaps 2011
nclee715
 
New Algorithms to Improve X-Ray Inspection
New Algorithms to Improve X-Ray InspectionNew Algorithms to Improve X-Ray Inspection
New Algorithms to Improve X-Ray Inspection
Bill Cardoso
 
C chap02
C chap02C chap02
C chap02
Kamran
 
File handling-dutt
File handling-duttFile handling-dutt
File handling-dutt
Anil Dutt
 
PIC_ARM_AVR
PIC_ARM_AVRPIC_ARM_AVR
PIC_ARM_AVR
Mahesh Vadhavaniya profmjv
 
Input Output Management In C Programming
Input Output Management In C ProgrammingInput Output Management In C Programming
Input Output Management In C Programming
Kamal Acharya
 
Mesics lecture 5 input – output in ‘c’
Mesics lecture 5   input – output in ‘c’Mesics lecture 5   input – output in ‘c’
Mesics lecture 5 input – output in ‘c’
eShikshak
 
Input and output in c
Input and output in cInput and output in c
Input and output in c
Rachana Joshi
 
Formatted input and output
Formatted input and outputFormatted input and output
Formatted input and output
Online
 
C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and...
C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and...C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and...
C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and...
yazad dumasia
 
Programming embedded system_ii_keil_8051(1)
Programming embedded system_ii_keil_8051(1)Programming embedded system_ii_keil_8051(1)
Programming embedded system_ii_keil_8051(1)
Fendie Mimpi
 
Automotive Circuit Boards
Automotive Circuit BoardsAutomotive Circuit Boards
Automotive Circuit Boards
Art Wood
 
C presentation book
C presentation bookC presentation book
C presentation book
krunal1210
 
RoHS Compliant Lead Free PCB Fabrication
RoHS Compliant Lead Free PCB FabricationRoHS Compliant Lead Free PCB Fabrication
RoHS Compliant Lead Free PCB Fabrication
Art Wood
 
Pcb Production and Prototype Manufacturing Capabilities for Saturn Electronic...
Pcb Production and Prototype Manufacturing Capabilities for Saturn Electronic...Pcb Production and Prototype Manufacturing Capabilities for Saturn Electronic...
Pcb Production and Prototype Manufacturing Capabilities for Saturn Electronic...
Art Wood
 
training_presentation
training_presentationtraining_presentation
training_presentation
Aniket Pawar
 
Epoxy flux a low cost high reliability approach for pop assembly-imaps 2011
Epoxy flux  a low cost high reliability approach for pop assembly-imaps 2011Epoxy flux  a low cost high reliability approach for pop assembly-imaps 2011
Epoxy flux a low cost high reliability approach for pop assembly-imaps 2011
nclee715
 
New Algorithms to Improve X-Ray Inspection
New Algorithms to Improve X-Ray InspectionNew Algorithms to Improve X-Ray Inspection
New Algorithms to Improve X-Ray Inspection
Bill Cardoso
 
C chap02
C chap02C chap02
C chap02
Kamran
 
File handling-dutt
File handling-duttFile handling-dutt
File handling-dutt
Anil Dutt
 
Ad

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

Console Io Operations
Console Io OperationsConsole Io Operations
Console Io Operations
archikabhatia
 
C-Programming C LIBRARIES AND USER DEFINED LIBRARIES.pptx
C-Programming  C LIBRARIES AND USER DEFINED LIBRARIES.pptxC-Programming  C LIBRARIES AND USER DEFINED LIBRARIES.pptx
C-Programming C LIBRARIES AND USER DEFINED LIBRARIES.pptx
SKUP1
 
C-Programming C LIBRARIES AND USER DEFINED LIBRARIES.pptx
C-Programming  C LIBRARIES AND USER DEFINED LIBRARIES.pptxC-Programming  C LIBRARIES AND USER DEFINED LIBRARIES.pptx
C-Programming C LIBRARIES AND USER DEFINED LIBRARIES.pptx
LECO9
 
Lecture 8- Data Input and Output
Lecture 8- Data Input and OutputLecture 8- Data Input and Output
Lecture 8- Data Input and Output
Md. Imran Hossain Showrov
 
Console i/o for c++
Console i/o for c++Console i/o for c++
Console i/o for c++
Darshan Radadiya
 
C programming session 08
C programming session 08C programming session 08
C programming session 08
Dushmanta Nath
 
Understanding java streams
Understanding java streamsUnderstanding java streams
Understanding java streams
Shahjahan Samoon
 
UNIT-II CP DOC.docx
UNIT-II CP DOC.docxUNIT-II CP DOC.docx
UNIT-II CP DOC.docx
JavvajiVenkat
 
programming language in c&c++
programming language in c&c++programming language in c&c++
programming language in c&c++
Haripritha
 
Built in function
Built in functionBuilt in function
Built in function
MD. Rayhanul Islam Sayket
 
7512635.ppt
7512635.ppt7512635.ppt
7512635.ppt
ssuserda85e6
 
Basics of c Nisarg Patel
Basics of c Nisarg PatelBasics of c Nisarg Patel
Basics of c Nisarg Patel
TechNGyan
 
CS 23001 Computer Science II Data Structures & AbstractionPro.docx
CS 23001 Computer Science II Data Structures & AbstractionPro.docxCS 23001 Computer Science II Data Structures & AbstractionPro.docx
CS 23001 Computer Science II Data Structures & AbstractionPro.docx
faithxdunce63732
 
Stream Based Input Output
Stream Based Input OutputStream Based Input Output
Stream Based Input Output
Bharat17485
 
D-38 vedant ICCPL.pptx
D-38 vedant ICCPL.pptxD-38 vedant ICCPL.pptx
D-38 vedant ICCPL.pptx
VedantSahane
 
(Lect. 2 & 3) Introduction to C.ppt
(Lect. 2 & 3) Introduction to C.ppt(Lect. 2 & 3) Introduction to C.ppt
(Lect. 2 & 3) Introduction to C.ppt
atulchaudhary821
 
CP Handout#2
CP Handout#2CP Handout#2
CP Handout#2
trupti1976
 
Header files in c
Header files in cHeader files in c
Header files in c
HoneyChintal
 
headerfilesinc-181121134545 (1).pdf
headerfilesinc-181121134545 (1).pdfheaderfilesinc-181121134545 (1).pdf
headerfilesinc-181121134545 (1).pdf
jazzcashlimit
 
source code which create file and write into it
source code which create file and write into itsource code which create file and write into it
source code which create file and write into it
melakusisay507
 
Console Io Operations
Console Io OperationsConsole Io Operations
Console Io Operations
archikabhatia
 
C-Programming C LIBRARIES AND USER DEFINED LIBRARIES.pptx
C-Programming  C LIBRARIES AND USER DEFINED LIBRARIES.pptxC-Programming  C LIBRARIES AND USER DEFINED LIBRARIES.pptx
C-Programming C LIBRARIES AND USER DEFINED LIBRARIES.pptx
SKUP1
 
C-Programming C LIBRARIES AND USER DEFINED LIBRARIES.pptx
C-Programming  C LIBRARIES AND USER DEFINED LIBRARIES.pptxC-Programming  C LIBRARIES AND USER DEFINED LIBRARIES.pptx
C-Programming C LIBRARIES AND USER DEFINED LIBRARIES.pptx
LECO9
 
C programming session 08
C programming session 08C programming session 08
C programming session 08
Dushmanta Nath
 
Understanding java streams
Understanding java streamsUnderstanding java streams
Understanding java streams
Shahjahan Samoon
 
programming language in c&c++
programming language in c&c++programming language in c&c++
programming language in c&c++
Haripritha
 
Basics of c Nisarg Patel
Basics of c Nisarg PatelBasics of c Nisarg Patel
Basics of c Nisarg Patel
TechNGyan
 
CS 23001 Computer Science II Data Structures & AbstractionPro.docx
CS 23001 Computer Science II Data Structures & AbstractionPro.docxCS 23001 Computer Science II Data Structures & AbstractionPro.docx
CS 23001 Computer Science II Data Structures & AbstractionPro.docx
faithxdunce63732
 
Stream Based Input Output
Stream Based Input OutputStream Based Input Output
Stream Based Input Output
Bharat17485
 
D-38 vedant ICCPL.pptx
D-38 vedant ICCPL.pptxD-38 vedant ICCPL.pptx
D-38 vedant ICCPL.pptx
VedantSahane
 
(Lect. 2 & 3) Introduction to C.ppt
(Lect. 2 & 3) Introduction to C.ppt(Lect. 2 & 3) Introduction to C.ppt
(Lect. 2 & 3) Introduction to C.ppt
atulchaudhary821
 
headerfilesinc-181121134545 (1).pdf
headerfilesinc-181121134545 (1).pdfheaderfilesinc-181121134545 (1).pdf
headerfilesinc-181121134545 (1).pdf
jazzcashlimit
 
source code which create file and write into it
source code which create file and write into itsource code which create file and write into it
source code which create file and write into it
melakusisay507
 
Ad

More from yazad dumasia (7)

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

Recently uploaded (20)

five-year-soluhhhhhhhhhhhhhhhhhtions.pdf
five-year-soluhhhhhhhhhhhhhhhhhtions.pdffive-year-soluhhhhhhhhhhhhhhhhhtions.pdf
five-year-soluhhhhhhhhhhhhhhhhhtions.pdf
AdityaSharma944496
 
How to use nRF24L01 module with Arduino
How to use nRF24L01 module with ArduinoHow to use nRF24L01 module with Arduino
How to use nRF24L01 module with Arduino
CircuitDigest
 
Main cotrol jdbjbdcnxbjbjzjjjcjicbjxbcjcxbjcxb
Main cotrol jdbjbdcnxbjbjzjjjcjicbjxbcjcxbjcxbMain cotrol jdbjbdcnxbjbjzjjjcjicbjxbcjcxbjcxb
Main cotrol jdbjbdcnxbjbjzjjjcjicbjxbcjcxbjcxb
SunilSingh610661
 
"Boiler Feed Pump (BFP): Working, Applications, Advantages, and Limitations E...
"Boiler Feed Pump (BFP): Working, Applications, Advantages, and Limitations E..."Boiler Feed Pump (BFP): Working, Applications, Advantages, and Limitations E...
"Boiler Feed Pump (BFP): Working, Applications, Advantages, and Limitations E...
Infopitaara
 
The Gaussian Process Modeling Module in UQLab
The Gaussian Process Modeling Module in UQLabThe Gaussian Process Modeling Module in UQLab
The Gaussian Process Modeling Module in UQLab
Journal of Soft Computing in Civil Engineering
 
Data Structures_Linear data structures Linked Lists.pptx
Data Structures_Linear data structures Linked Lists.pptxData Structures_Linear data structures Linked Lists.pptx
Data Structures_Linear data structures Linked Lists.pptx
RushaliDeshmukh2
 
Resistance measurement and cfd test on darpa subboff model
Resistance measurement and cfd test on darpa subboff modelResistance measurement and cfd test on darpa subboff model
Resistance measurement and cfd test on darpa subboff model
INDIAN INSTITUTE OF TECHNOLOGY KHARAGPUR
 
theory-slides-for react for beginners.pptx
theory-slides-for react for beginners.pptxtheory-slides-for react for beginners.pptx
theory-slides-for react for beginners.pptx
sanchezvanessa7896
 
Artificial Intelligence (AI) basics.pptx
Artificial Intelligence (AI) basics.pptxArtificial Intelligence (AI) basics.pptx
Artificial Intelligence (AI) basics.pptx
aditichinar
 
Level 1-Safety.pptx Presentation of Electrical Safety
Level 1-Safety.pptx Presentation of Electrical SafetyLevel 1-Safety.pptx Presentation of Electrical Safety
Level 1-Safety.pptx Presentation of Electrical Safety
JoseAlbertoCariasDel
 
Lidar for Autonomous Driving, LiDAR Mapping for Driverless Cars.pptx
Lidar for Autonomous Driving, LiDAR Mapping for Driverless Cars.pptxLidar for Autonomous Driving, LiDAR Mapping for Driverless Cars.pptx
Lidar for Autonomous Driving, LiDAR Mapping for Driverless Cars.pptx
RishavKumar530754
 
Introduction to Zoomlion Earthmoving.pptx
Introduction to Zoomlion Earthmoving.pptxIntroduction to Zoomlion Earthmoving.pptx
Introduction to Zoomlion Earthmoving.pptx
AS1920
 
MAQUINARIA MINAS CEMA 6th Edition (1).pdf
MAQUINARIA MINAS CEMA 6th Edition (1).pdfMAQUINARIA MINAS CEMA 6th Edition (1).pdf
MAQUINARIA MINAS CEMA 6th Edition (1).pdf
ssuser562df4
 
Development of MLR, ANN and ANFIS Models for Estimation of PCUs at Different ...
Development of MLR, ANN and ANFIS Models for Estimation of PCUs at Different ...Development of MLR, ANN and ANFIS Models for Estimation of PCUs at Different ...
Development of MLR, ANN and ANFIS Models for Estimation of PCUs at Different ...
Journal of Soft Computing in Civil Engineering
 
new ppt artificial intelligence historyyy
new ppt artificial intelligence historyyynew ppt artificial intelligence historyyy
new ppt artificial intelligence historyyy
PianoPianist
 
Data Structures_Searching and Sorting.pptx
Data Structures_Searching and Sorting.pptxData Structures_Searching and Sorting.pptx
Data Structures_Searching and Sorting.pptx
RushaliDeshmukh2
 
Machine learning project on employee attrition detection using (2).pptx
Machine learning project on employee attrition detection using (2).pptxMachine learning project on employee attrition detection using (2).pptx
Machine learning project on employee attrition detection using (2).pptx
rajeswari89780
 
ELectronics Boards & Product Testing_Shiju.pdf
ELectronics Boards & Product Testing_Shiju.pdfELectronics Boards & Product Testing_Shiju.pdf
ELectronics Boards & Product Testing_Shiju.pdf
Shiju Jacob
 
DATA-DRIVEN SHOULDER INVERSE KINEMATICS YoungBeom Kim1 , Byung-Ha Park1 , Kwa...
DATA-DRIVEN SHOULDER INVERSE KINEMATICS YoungBeom Kim1 , Byung-Ha Park1 , Kwa...DATA-DRIVEN SHOULDER INVERSE KINEMATICS YoungBeom Kim1 , Byung-Ha Park1 , Kwa...
DATA-DRIVEN SHOULDER INVERSE KINEMATICS YoungBeom Kim1 , Byung-Ha Park1 , Kwa...
charlesdick1345
 
Smart Storage Solutions.pptx for production engineering
Smart Storage Solutions.pptx for production engineeringSmart Storage Solutions.pptx for production engineering
Smart Storage Solutions.pptx for production engineering
rushikeshnavghare94
 
five-year-soluhhhhhhhhhhhhhhhhhtions.pdf
five-year-soluhhhhhhhhhhhhhhhhhtions.pdffive-year-soluhhhhhhhhhhhhhhhhhtions.pdf
five-year-soluhhhhhhhhhhhhhhhhhtions.pdf
AdityaSharma944496
 
How to use nRF24L01 module with Arduino
How to use nRF24L01 module with ArduinoHow to use nRF24L01 module with Arduino
How to use nRF24L01 module with Arduino
CircuitDigest
 
Main cotrol jdbjbdcnxbjbjzjjjcjicbjxbcjcxbjcxb
Main cotrol jdbjbdcnxbjbjzjjjcjicbjxbcjcxbjcxbMain cotrol jdbjbdcnxbjbjzjjjcjicbjxbcjcxbjcxb
Main cotrol jdbjbdcnxbjbjzjjjcjicbjxbcjcxbjcxb
SunilSingh610661
 
"Boiler Feed Pump (BFP): Working, Applications, Advantages, and Limitations E...
"Boiler Feed Pump (BFP): Working, Applications, Advantages, and Limitations E..."Boiler Feed Pump (BFP): Working, Applications, Advantages, and Limitations E...
"Boiler Feed Pump (BFP): Working, Applications, Advantages, and Limitations E...
Infopitaara
 
Data Structures_Linear data structures Linked Lists.pptx
Data Structures_Linear data structures Linked Lists.pptxData Structures_Linear data structures Linked Lists.pptx
Data Structures_Linear data structures Linked Lists.pptx
RushaliDeshmukh2
 
theory-slides-for react for beginners.pptx
theory-slides-for react for beginners.pptxtheory-slides-for react for beginners.pptx
theory-slides-for react for beginners.pptx
sanchezvanessa7896
 
Artificial Intelligence (AI) basics.pptx
Artificial Intelligence (AI) basics.pptxArtificial Intelligence (AI) basics.pptx
Artificial Intelligence (AI) basics.pptx
aditichinar
 
Level 1-Safety.pptx Presentation of Electrical Safety
Level 1-Safety.pptx Presentation of Electrical SafetyLevel 1-Safety.pptx Presentation of Electrical Safety
Level 1-Safety.pptx Presentation of Electrical Safety
JoseAlbertoCariasDel
 
Lidar for Autonomous Driving, LiDAR Mapping for Driverless Cars.pptx
Lidar for Autonomous Driving, LiDAR Mapping for Driverless Cars.pptxLidar for Autonomous Driving, LiDAR Mapping for Driverless Cars.pptx
Lidar for Autonomous Driving, LiDAR Mapping for Driverless Cars.pptx
RishavKumar530754
 
Introduction to Zoomlion Earthmoving.pptx
Introduction to Zoomlion Earthmoving.pptxIntroduction to Zoomlion Earthmoving.pptx
Introduction to Zoomlion Earthmoving.pptx
AS1920
 
MAQUINARIA MINAS CEMA 6th Edition (1).pdf
MAQUINARIA MINAS CEMA 6th Edition (1).pdfMAQUINARIA MINAS CEMA 6th Edition (1).pdf
MAQUINARIA MINAS CEMA 6th Edition (1).pdf
ssuser562df4
 
new ppt artificial intelligence historyyy
new ppt artificial intelligence historyyynew ppt artificial intelligence historyyy
new ppt artificial intelligence historyyy
PianoPianist
 
Data Structures_Searching and Sorting.pptx
Data Structures_Searching and Sorting.pptxData Structures_Searching and Sorting.pptx
Data Structures_Searching and Sorting.pptx
RushaliDeshmukh2
 
Machine learning project on employee attrition detection using (2).pptx
Machine learning project on employee attrition detection using (2).pptxMachine learning project on employee attrition detection using (2).pptx
Machine learning project on employee attrition detection using (2).pptx
rajeswari89780
 
ELectronics Boards & Product Testing_Shiju.pdf
ELectronics Boards & Product Testing_Shiju.pdfELectronics Boards & Product Testing_Shiju.pdf
ELectronics Boards & Product Testing_Shiju.pdf
Shiju Jacob
 
DATA-DRIVEN SHOULDER INVERSE KINEMATICS YoungBeom Kim1 , Byung-Ha Park1 , Kwa...
DATA-DRIVEN SHOULDER INVERSE KINEMATICS YoungBeom Kim1 , Byung-Ha Park1 , Kwa...DATA-DRIVEN SHOULDER INVERSE KINEMATICS YoungBeom Kim1 , Byung-Ha Park1 , Kwa...
DATA-DRIVEN SHOULDER INVERSE KINEMATICS YoungBeom Kim1 , Byung-Ha Park1 , Kwa...
charlesdick1345
 
Smart Storage Solutions.pptx for production engineering
Smart Storage Solutions.pptx for production engineeringSmart Storage Solutions.pptx for production engineering
Smart Storage Solutions.pptx for production engineering
rushikeshnavghare94
 

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