Getche function >> conio.h Header file >> Library Functions in C Programming
What it does :
- Getche accepts character from console
- Character accepted echoes to the screen [ displayed on screen ]
- Header File : conio.h
int getche(void);
Live Examples :
#include"stdio.h"
#include"conio.h"
void main(void)
{
char ch;
printf("Input a character:");
ch = getche();
printf("nYou input a '%c'n", ch);
}
Output :
You input a 'x'
Ways of Using getche function :
Way 1 : To Loop back
void main()
{
char ch;
do
{
printf("You are in Do while Loop ");
printf("Do you want to continue , Y to continue , N to quit ");
ch = getche();
}while(ch!='N');
}
Bookmark & Share