Usage of getch() Function in C or C++ : Like a scanf() function in c, getch() is also a predefined function to accept input and define in conio.h header file. scanf() accept only number or character as input, but getch() accept any key as input and work further.
#include<stdio.h> #include<conio.h> void main() { char ch; ch=getch(); printf("\n ASCII Code of Key : %d",ch); } Note : Work with Turboc Editor