SlideShare a Scribd company logo
1 of 25
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

structure and union
structure and unionstructure and union
structure and union
student
 

What's hot (20)

Strings in c
Strings in cStrings in c
Strings in c
 
Array and string
Array and stringArray and string
Array and string
 
Functions in C
Functions in CFunctions in C
Functions in C
 
String in c
String in cString in c
String in c
 
File in C language
File in C languageFile in C language
File in C language
 
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
 
Structures in c language
Structures in c languageStructures in c language
Structures in c language
 
Strings IN C
Strings IN CStrings IN C
Strings IN C
 
RECURSION IN C
RECURSION IN C RECURSION IN C
RECURSION IN C
 
Input output statement in C
Input output statement in CInput output statement in C
Input output statement in C
 
Loops in c
Loops in cLoops in c
Loops in c
 
C programming - String
C programming - StringC programming - String
C programming - String
 
structure and union
structure and unionstructure and union
structure and union
 
File handling in c
File handling in cFile handling in c
File handling in c
 
Functions in c language
Functions in c language Functions in c language
Functions in c language
 
MANAGING INPUT AND OUTPUT OPERATIONS IN C MRS.SOWMYA JYOTHI.pdf
MANAGING INPUT AND OUTPUT OPERATIONS IN C    MRS.SOWMYA JYOTHI.pdfMANAGING INPUT AND OUTPUT OPERATIONS IN C    MRS.SOWMYA JYOTHI.pdf
MANAGING INPUT AND OUTPUT OPERATIONS IN C MRS.SOWMYA JYOTHI.pdf
 
String in c programming
String in c programmingString in c programming
String in c programming
 
File Management in C
File Management in CFile Management in C
File Management in C
 
Strings
StringsStrings
Strings
 
Function overloading
Function overloadingFunction overloading
Function overloading
 

Viewers also liked

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
 
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
 
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
 

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
 
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’
 
Basic Input and Output
Basic Input and OutputBasic Input and Output
Basic Input and Output
 
Input and output in c
Input and output in cInput and output in c
Input and output in c
 
Managing console
Managing consoleManaging console
Managing console
 
Formatted input and output
Formatted input and outputFormatted input and output
Formatted input and output
 
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...
 
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)
 
Automotive Circuit Boards
Automotive Circuit BoardsAutomotive Circuit Boards
Automotive Circuit Boards
 
C presentation book
C presentation bookC presentation book
C presentation book
 
RoHS Compliant Lead Free PCB Fabrication
RoHS Compliant Lead Free PCB FabricationRoHS Compliant Lead Free PCB Fabrication
RoHS Compliant Lead Free PCB Fabrication
 
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
 
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...
 
Reflow oven
Reflow ovenReflow oven
Reflow oven
 
training_presentation
training_presentationtraining_presentation
training_presentation
 
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
 
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
 
C chap02
C chap02C chap02
C chap02
 
File handling-dutt
File handling-duttFile handling-dutt
File handling-dutt
 
PIC_ARM_AVR
PIC_ARM_AVRPIC_ARM_AVR
PIC_ARM_AVR
 

Similar to Managing input and output operation in c

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
 
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
 
headerfilesinc-181121134545 (1).pdf
headerfilesinc-181121134545 (1).pdfheaderfilesinc-181121134545 (1).pdf
headerfilesinc-181121134545 (1).pdf
jazzcashlimit
 

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

Console Io Operations
Console Io OperationsConsole Io Operations
Console Io Operations
 
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
 
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
 
Lecture 8- Data Input and Output
Lecture 8- Data Input and OutputLecture 8- Data Input and Output
Lecture 8- Data Input and Output
 
Console i/o for c++
Console i/o for c++Console i/o for c++
Console i/o for c++
 
C programming session 08
C programming session 08C programming session 08
C programming session 08
 
Understanding java streams
Understanding java streamsUnderstanding java streams
Understanding java streams
 
UNIT-II CP DOC.docx
UNIT-II CP DOC.docxUNIT-II CP DOC.docx
UNIT-II CP DOC.docx
 
programming language in c&c++
programming language in c&c++programming language in c&c++
programming language in c&c++
 
Built in function
Built in functionBuilt in function
Built in function
 
7512635.ppt
7512635.ppt7512635.ppt
7512635.ppt
 
Basics of c Nisarg Patel
Basics of c Nisarg PatelBasics of c Nisarg Patel
Basics of c Nisarg Patel
 
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
 
Stream Based Input Output
Stream Based Input OutputStream Based Input Output
Stream Based Input Output
 
D-38 vedant ICCPL.pptx
D-38 vedant ICCPL.pptxD-38 vedant ICCPL.pptx
D-38 vedant ICCPL.pptx
 
(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
 
CP Handout#2
CP Handout#2CP Handout#2
CP Handout#2
 
Header files in c
Header files in cHeader files in c
Header files in c
 
headerfilesinc-181121134545 (1).pdf
headerfilesinc-181121134545 (1).pdfheaderfilesinc-181121134545 (1).pdf
headerfilesinc-181121134545 (1).pdf
 
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
 

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.
 
Schemas for multidimensional databases
Schemas for multidimensional databasesSchemas for multidimensional databases
Schemas for multidimensional databases
 
Classification decision tree
Classification  decision treeClassification  decision tree
Classification decision tree
 
Basic economic problem: Inflation
Basic economic problem: InflationBasic economic problem: Inflation
Basic economic problem: Inflation
 
Groundwater contamination
Groundwater contaminationGroundwater contamination
Groundwater contamination
 
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
 
Cyber crime
Cyber crimeCyber crime
Cyber crime
 

Recently uploaded

Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Christo Ananth
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
MsecMca
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Recently uploaded (20)

Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdf
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
 
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELLPVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
 
Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 

Managing input and output operation in c

  • 1.
  • 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