Managing Input Outout Function
Managing Input Outout Function
Managing Input Outout Function
functions
Managing Input / output functions
In ‘C’ language I/O functions are categorized into following two
types
Input/output function
getchar(); putchar();
gets(); scanf(); printf();
puts();
getch();
getche();
scanf();
The scanf() function is an input function.
It used to read the mixed type of data from the
keyboard.
You can read integer, float and character data by using
its control codes or format codes.
Syntax:
scanf(“control string”,&v1,&v2…);
Example: scanf(“%d”,&n);
Syntax: gets(v);
Example: char s[20]; gets(s);
getch():
This is also an input function.
This is used to read a single character from the keyboard
like getchar() function.
➢ But getchar() function is a buffered function;
➢ getch() function is a non buffered function.
➢ When type the character data from the keyboard it does
not visible on the screen.
Syntax: v=getch();
getche():
All are same as getch() function except
that when you type the character data
from the keyboard it will be visible on the
screen.
Syntax: v=getche();
putchar():
This function is an output function. It is
used to display a single character on the
screen.
Syntax: putchar(v);