getch

Overview :

This function is used to get character from the user.

Syntax :
int getch();
Description :
  • getch is used to get the character from the user.
  • getch does not echo character to the console.

"getch" function return a character.
Example :
#include<stdio.h>
#include<conio.h>

void main()
{
  char a;
  printf("\nPress any key : ");
  a = getch();
  printf("\nYou entered %c",a);
  getch();
}

/*OUTPUT

Press any key : 
You entered d 

*/

Comments

comments powered by Disqus